Last active
December 22, 2024 22:50
-
-
Save se7enack/ce1b2166a13d665db17adb151e1fd3f0 to your computer and use it in GitHub Desktop.
Revisions
-
se7enack revised this gist
Dec 22, 2024 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,7 @@ string = ".720p.WEB.h264-ETHEL" # Get the current working directory cwd = os.getcwd() # Get a list of all the files in the current directory files = os.listdir(cwd) @@ -18,4 +17,4 @@ new_name = file.replace(string, "") # Rename the file os.rename(old_name, new_name) -
se7enack created this gist
Dec 22, 2024 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #!/usr/bin/env python3 import os string = ".720p.WEB.h264-ETHEL" # Get the current working directory #cwd = os.getcwd() cwd = "/Users/user/Desktop/w2wtest" # Get a list of all the files in the current directory files = os.listdir(cwd) # Iterate over the files and rename them for file in files: # Get the old and new names of the file old_name = file new_name = file.replace(string, "") # Rename the file os.rename(old_name, new_name)