Python mengganti nama file
import os
os.rename('guru99.txt','career.guru99.txt')
Cirex
import os
os.rename('guru99.txt','career.guru99.txt')
import os
os.rename('old_name.txt','new_name.txt')
import os
old_file_name = "/home/career_karma/raw_data.csv"
new_file_name = "/home/career_karma/old_data.csv"
os.rename(old_file_name, new_file_name)
print("File renamed!")
# input and output folder names and path
src_folder = r"C:/Projects/Python/ImageConverter/Image/"
dst_folder = r"C:/ConvertedImages/"
# Search files with .pdf extension in source directory
pattern = "\*.pdf"
files = glob.glob(src_folder + pattern)
# move the files with pdf extension
for file in files:
# extract file name form file path
file_name = os.path.basename(file)
file_name = file_name.replace('.jpg', '')
shutil.move(file, dst_folder + file_name)
print('Moved:', file)
import os
os.rename(r'C:\Users\Ron\Desktop\Test\Products.txt',r'C:\Users\Ron\Desktop\Test\Shipped Products.txt')
import os
os.rename('a.txt', 'b.kml')'