Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

rename files

import os
#replace 'b4lib with the relative path of the folder
for filename in os.listdir('b4lib'):
    # print(filename)
    #replace 'full_path' with the full path of the directory with your file
    f = os.path.join('full_path',filename)
    print(f)
    # rename the file. The below code removes '-Copy1' from the filename
    os.rename(f, f.replace('-Copy1', ''))
 
PREVIOUS NEXT
Tagged: #rename #files
ADD COMMENT
Topic
Name
6+5 =