mirror of
https://github.com/nikdoof/tvorganise.git
synced 2025-12-13 06:42:16 +00:00
Use rename and fix minor issues
This commit is contained in:
@@ -265,7 +265,7 @@ def main():
|
|||||||
# Warn if no files are found, then exit
|
# Warn if no files are found, then exit
|
||||||
if len(files) == 0:
|
if len(files) == 0:
|
||||||
print colour('No files found','red')
|
print colour('No files found','red')
|
||||||
sys.exit(1)
|
sys.exit(0)
|
||||||
#end if files == 0
|
#end if files == 0
|
||||||
|
|
||||||
for name in files:
|
for name in files:
|
||||||
@@ -287,14 +287,14 @@ def main():
|
|||||||
if same_partition(oldfile, newpath):
|
if same_partition(oldfile, newpath):
|
||||||
print "[*] Moving file"
|
print "[*] Moving file"
|
||||||
try:
|
try:
|
||||||
shutil.rename(oldfile, newpath)
|
os.rename(oldfile, newfile)
|
||||||
except Exception, errormsg:
|
except Exception, errormsg:
|
||||||
print "[!] Error moving file! %s" % (errormsg)
|
print "[!] Error moving file! %s" % (errormsg)
|
||||||
#end try
|
#end try
|
||||||
else:
|
else:
|
||||||
print "[*] Copying file"
|
print "[*] Copying file"
|
||||||
try:
|
try:
|
||||||
shutil.move(oldfile, newfile)
|
shutil.copy(oldfile, newfile)
|
||||||
except Exception, errormsg:
|
except Exception, errormsg:
|
||||||
print "[!] Error copying file! %s" % (errormsg)
|
print "[!] Error copying file! %s" % (errormsg)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user