Copy file instead of moving to prevent Invalid cross-device link error

This commit is contained in:
Buddy Sandidge 2014-01-27 22:41:40 -08:00
parent 8ea3754920
commit 5b26210dde

View File

@ -6,6 +6,7 @@ Move a document to the correct documents folder
import filecmp
import os
import re
import shutil
import sys
from datetime import date
@ -64,7 +65,8 @@ if __name__ == "__main__":
if not os.path.isfile(new_file_path):
print "Moving file '%s' to '%s'" % (file_name, new_file_path)
os.rename(file_name, new_file_path)
shutil.copyfile(file_name, new_file_path)
os.unlink(file_name)
else:
if filecmp.cmp(new_file_path, file_name):
print "Two files already exist and are same: '%s' and '%s'" % \