From 7e5c514638eb9e7b4653f0d50ef3bd491d79b122 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Fri, 24 Jun 2011 16:47:43 +0200 Subject: [PATCH] CC-2272 : Ability to change storage directory location copying each thing from the direcotyr separately to avoid overwriting anything that already exists in the new stor. --- .../airtimefilemonitor/airtimenotifier.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py b/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py index e1121ef37..c8607b1a9 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py @@ -74,7 +74,15 @@ class AirtimeNotifier(Notifier): mm.wm.rm_watch(wd, rec=True) mm.set_needed_file_permissions(new_storage_directory, True) - mm.move_file(storage_directory, new_storage_directory) + + #move everything in old stor directory to the new stor directory. + old_storage_contents = os.listdir(storage_directory) + for item in old_storage_contents: + fp = "%s/%s" % (storage_directory, item) + nfp = "%s/%s" % (new_storage_directory, item) + self.logger.info("Moving %s to %s", fp, nfp) + mm.move_file(fp, nfp) + self.config.storage_directory = new_storage_directory mm.watch_directory(new_storage_directory)