Python Scripts: Difference between revisions
Content added Content deleted
Line 687:
<pre>
#!/usr/bin/env python3
# Need to write Results to a file in script dir▼
import os
import imghdr
Line 693 ⟶ 694:
directory = sys.argv[1]
▲# Need to write Results to a file in script dir
for root, dirs, files in os.walk(directory):
Line 706 ⟶ 704:
# find files with the (incorrect) extension to rename
if
if ftype !=
if ftype != None:
# rename the file
shutil.move(file, file.replace(ext,ftype))
print (file, ext, ("=>"), ftype)
# in case it can't be determined, mention it in the output
else:
print("could not determine: "+file)
else:
print (
else:
print ("done")
|