Created
August 3, 2020 23:03
-
-
Save profrodai/ecb45c9d4cab6f58e66106b2eed59079 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| from pathlib import Path | |
| import os | |
| p = Path('03_Books/') | |
| for ix, path in enumerate(sorted(os.listdir(p))): | |
| if '.DS_Store' not in path: | |
| full_path = os.path.join(p, path) | |
| if os.path.isdir(full_path): | |
| if ix < 10: | |
| ix = f'0{ix}' | |
| new_path = os.path.join(p, f'0{ix}_{path}') | |
| os.rename(full_path, new_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment