Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python program to rename all file

# Python program to rename all file
# names in your directory
import os
 
os.chdir('D:Geeksforgeeks')
print(os.getcwd())
 
for count, f in enumerate(os.listdir()):
    f_name, f_ext = os.path.splitext(f)
    f_name = "geek" + str(count)
 
    new_name = f'{f_name}{f_ext}'
    os.rename(f, new_name)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Python #program #rename #file
ADD COMMENT
Topic
Name
8+1 =