0

I have thousands of files to be renamed in several subfolders in the main folder. The existing file name, path, and the new file name are available in an excel file. I have been using Excel VBA to do this earlier and now I am into Python and would like to accomplish this task using Python.

I am looking for a solution as below:

  1. Renaming the files in the same place

  2. Copying the files with folders to a new location and rename there to preserver the originals.

Please provide your valuable inputs.

thepunitsingh
  • 713
  • 1
  • 12
  • 30
  • What have you tried so far? You should probably take a look at `os`, `glob` and `shutil` modules, they have all the necessary functionality. – NotAName Dec 22 '20 at 07:15
  • 1
    `pathlib` is better as it intuitively incorporates the modules mentioned above – Mandera Dec 22 '20 at 07:18
  • If you have working VBA code, a starting point can be just rewriting that code with Python commands. If that gives you trouble, share your code here and get some answers. – Grismar Dec 22 '20 at 07:29
  • You can check these out [renaming](https://stackoverflow.com/questions/37467561/renaming-multiple-files-in-a-directory-using-python) and [copying](https://stackoverflow.com/questions/123198/how-do-i-copy-a-file-in-python) – Ricco D Dec 22 '20 at 09:15

0 Answers0