From f18d5aca10d3811fdd64841a0f1426dd028fecc5 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 22 Jan 2010 11:42:52 +0000 Subject: [PATCH] Use rename and fix minor issues --- autoPathTv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoPathTv.py b/autoPathTv.py index a899a13..b074820 100755 --- a/autoPathTv.py +++ b/autoPathTv.py @@ -265,7 +265,7 @@ def main(): # Warn if no files are found, then exit if len(files) == 0: print colour('No files found','red') - sys.exit(1) + sys.exit(0) #end if files == 0 for name in files: @@ -287,14 +287,14 @@ def main(): if same_partition(oldfile, newpath): print "[*] Moving file" try: - shutil.rename(oldfile, newpath) + os.rename(oldfile, newfile) except Exception, errormsg: print "[!] Error moving file! %s" % (errormsg) #end try else: print "[*] Copying file" try: - shutil.move(oldfile, newfile) + shutil.copy(oldfile, newfile) except Exception, errormsg: print "[!] Error copying file! %s" % (errormsg) else: