Created
July 18, 2020 08:14
-
-
Save MrAmbiG/a8bcbf77157a30a964773bf5d477522f to your computer and use it in GitHub Desktop.
python rename files in a directory
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
# Pythono3 code to rename multiple | |
# files in a directory or folder | |
# importing os module | |
import os | |
# Function to rename multiple files | |
def main(): | |
for file in os.listdir(): | |
original = file | |
new = original.replace("[M@nI] ", "") | |
os.rename(original, new) | |
# Driver Code | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment