Index: /branches/ipp-259_genericise_backups/tools/backups/backup_atlassian_applications.py
===================================================================
--- /branches/ipp-259_genericise_backups/tools/backups/backup_atlassian_applications.py	(revision 40910)
+++ /branches/ipp-259_genericise_backups/tools/backups/backup_atlassian_applications.py	(revision 40911)
@@ -10,47 +10,8 @@
 
 import backups.utils.subprocess_utils as sub_utils
+import backups.utils.generic_utils as gen_utils
 from backups.utils.errors import ConfigError, SubprocessError
 
 DEFAULT_CONFIG_FILE = path.join(path.dirname(__file__), 'atlassian_backups.config')
-
-
-def _move_dir_contents_to_dir(source_dirs: [str], destination_dirs: [str], verbose: bool=False):
-    """ Moves all files from inside source paths to the destination dits.
-It's important to note that it moves index to index
-i.e. source[0] -> dest[0]; source[1] -> dest[1]
-
-This is actually a pretty generic function, should be moved into a utils class.
-"""
-
-    if source_dirs is None or destination_dirs is None:
-        print("Error: You need to supply a source and destination")
-        return 2
-    if type(source_dirs) != list or type(destination_dirs) != list:
-        print("Error: source_dirs and destination_dirs must be type: list")
-        print("     type {0} and {1} given".format(type(source_dirs), type(destination_dirs)))
-        return 2
-    if len(source_dirs) != len(destination_dirs):
-        print("Error: source and target paths are not equal; aborting file movement")
-        return 2
-
-    for i in range(0, len(source_dirs)):
-        # Identify files in path, move each one:
-        wildcard_search = "{0}/*".format(source_dirs[i])
-        filepaths = glob.glob(wildcard_search)
-        if len(filepaths) == 0:
-            print("Warning: directory is empty: ", source_dirs[i])
-            continue
-        try:
-            for fp in filepaths:
-                if verbose:
-                    print("Moving: {0} -> {1}".format(fp, destination_dirs[i]))
-                command_and_args = ["mv", fp, destination_dirs[i]]
-                # shutil.move(fp, destination_dirs[i])
-                sub_utils.simple_unix_wrapper(command_and_args)
-        except IOError as e:
-            print("IOError copying: ", e.filename, e.filename2)
-            return 2
-
-    return 0
 
 
@@ -129,5 +90,5 @@
 
         # Move latest to tmp (and delete if move ok)
-        _move_dir_contents_to_dir(latest_paths, tmp_paths, self.verbose)
+        gen_utils.copy_multiple_items_to_multiple_dirs(latest_paths, tmp_paths, self.verbose)
 
         # copy jira
@@ -145,8 +106,8 @@
         # If successful: move tmp to old
         if jira_return == 0 and conf_return == 0 and tar_return == 0 and mysqldump_return == 0:
-            _move_dir_contents_to_dir(tmp_paths, old_paths, self.verbose)
+            gen_utils.copy_multiple_items_to_multiple_dirs(tmp_paths, old_paths, self.verbose)
         else:
             # If any failed: delete latest, move tmp back
-            _move_dir_contents_to_dir(tmp_paths, latest_paths, self.verbose)
+            gen_utils.copy_multiple_items_to_multiple_dirs(tmp_paths, latest_paths, self.verbose)
             return 5
 
