8

Python program to rename multiple files

 1 year ago
source link: https://www.geeksforgeeks.org/videos/python-program-to-rename-multiple-files/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Python program to rename multiple files

Python program to rename multiple files
So hello everyone. Welcome to Geeks for geeks. Today we're going to learn
  • 160 Views
  • 23/08/2022

In this video, we will learn how to Rename multiple files using Python

To rename multiple files we will use Os module. 

The Os module provide two method that is:

1) os.rename(src, dst): method is used to rename a file or directory.

2) os.listdir(): The listdir method lists out all the content of a given directory. It goes through all of the lists of file in the xyz folder, defines the source (src) and destination (dst) addresses, and renames using the rename module. 

The allowed format for source and destination addresses in the os.rename(src,dst) function is "folder name/file name".

Rename multiple files using Python
https://www.geeksforgeeks.org/rename-multiple-files-using-python/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK