Created
May 25, 2020 04:33
-
-
Save igorferreira/81306a29e2917840d5af2a592dd41b64 to your computer and use it in GitHub Desktop.
Renomeia diretórios no formato data
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
| import os | |
| basedir = "/root/Scripts/myren/sandbox" | |
| for old_name in os.listdir(basedir): | |
| res = " ".join(reversed(old_name.rsplit('-'))) | |
| print("Reverse folder.: " + str(old_name)) | |
| new_name = str(res).replace(" ","-") | |
| print("Reversing to...: " + str(new_name)) | |
| os.rename(os.path.join(basedir,old_name),os.path.join(basedir,new_name)) | |
| print("done!") | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Diretório com as pastas assim:
Saída: