Last active
March 25, 2020 09:25
-
-
Save diegoquintanav/c76a5acc4d916587695fb639a20cb39a to your computer and use it in GitHub Desktop.
rename files using python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# basic renaming of files, to enforce a minimum consistency | |
from pathlib import Path | |
for ix, file in enumerate(sorted(Path.cwd().glob('*'))): | |
new_filename = f'{ix:02}_' + file.name.lower().replace(' ','_') | |
print(f'{file.name} > {new_filename}') | |
file.rename(new_filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment