Search code examples
renamefile-renamebatch-rename

Rename massive files in multiple directories


I come to you guys because I do not know the way cuz I'm a nob, but I will investigate how to do what you answer me to make it.

I understand I need to create a Script, well, can you help me telling me how it has to be? And I will investigate the rest. Btw I'm using mac os Catalina, and Win10 on Parallels.

I need to rename 24000 .jpg files they are distributed in more than 2,000 directories, (the parent directory is in desk btw) but I need to add the directory name BEFORE the real name of the files, I want this so they can all stay in one directory and keep order.

This is an extract of the filelist, and here is the entire .txt filelist on MF.

.
├── 1-Architecture and Design
│   ├── 3D Business Building
│   │   ├── shutterstock_71036254.jpg
│   │   ├── shutterstock_71036287.jpg
│   │   ├── shutterstock_71036290.jpg
│   │   └── shutterstock_72979264.jpg
│   ├── 3D Construction & Project
│   │   ├── shutterstock_10472749.jpg
│   │   ├── shutterstock_10486771.jpg
│   │   ├── shutterstock_10518571.jpg
│   │   ├── shutterstock_10574383.jpg
│   ├── 3D Frames Set
│   │   ├── shutterstock_90316177.jpg
│   │   ├── shutterstock_90316195.jpg
│   │   ├── shutterstock_90316198.jpg
│   │   ├── shutterstock_90316201.jpg
│   │   └── shutterstock_90316207.jpg
├── 2-Food and Drink
│   ├── Almonds
│   │   ├── shutterstock_68684467.jpg
│   │   ├── shutterstock_81734134.jpg
│   │   ├── shutterstock_81734977.jpg
│   │   ├── shutterstock_81736846.jpg
│   │   └── shutterstock_83209996.jpg
│   ├── Anise and Cinnamon Spices
│   │   ├── shutterstock_17474206.jpg
│   │   ├── shutterstock_20572118.jpg
│   │   ├── shutterstock_47658130.jpg
│   │   └── shutterstock_65957044.jpg
│   ├── Apple
│   │   ├── shutterstock_29247376.jpg
│   │   ├── shutterstock_29247382.jpg
│   │   ├── shutterstock_32146864.jpg
│   │   └── shutterstock_47037607.jpg
.   .
.   .
.   .
etc

And it has to finish like this:

.
├── Main Directory
    ├──1-Architecture and Design-3D Business Building-shutterstock_71036254.jpg
    ├──1-Architecture and Design-3D Construction & Project-shutterstock_10472749.jpg
    ├──1-Architecture and Design-3D Frames Set-shutterstock_90316177.jpg
    ├──2-Food and Drink-Almonds-shutterstock_68684467.jpg
    ├──2-Food and Drink-Anise and Cinnamon Spices-shutterstock_17474206.jpg
    ├──2-Food and Drink-Apple-shutterstock_29247376.jpg
    .
    .
    .
    etc

I need to preserve one symbol like - to separate the directories in the filenames.

And don't care if the - has to be _ or something else, either if before I need to eliminate the spaces, I just need rename the files with the directory of each one.

Thank you so mucho to read me and take care : )


Solution

  • Finally I got it. I had to use "A Better Finder Rename V.11.11.27", the program allowed me to do exactly what I needed, it let me choose up to 6 level of parental folders to rename my files.

    I leave this answer to my question as a solution in case someone needs to do the same.

    I am attaching screenshots.

    You can see the name before and after All in just 15 seconds.