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

Buddy Sandidge 11 years ago
parent 8ea3754920
commit 5b26210dde

@ -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'" % \

Loading…
Cancel
Save