Rename files by adding part of folder name

Bulk Rename Utility How-To's

Re: Rename files by adding part of folder name

Postby Admin » Sun Aug 03, 2025 1:05 am

Hi, paste the original script that is working and the new requirements here: https://bulkrename.software/js/
cheers
Admin
Site Admin
 
Posts: 3047
Joined: Tue Mar 08, 2005 8:39 pm

Re: Rename files by adding part of folder name

Postby MrMix » Mon Aug 04, 2025 12:55 pm

Hello and thank you for your reply.
I don't know how but I succeeded to get what I wanted :shock:
I modified the last row
Admin wrote:
Code: Select all
newName = prefix + album + " - " + rest;

into
newName = prefix + album + "_"+ object("container") + " - " + rest;

Now if I have files into a main folder the first script is working fine,
if I have files into a sub folder the second script is working fine but not vice versa.
Would it be possible to create only one script able to understand if files are into
the main folder (use first script) and/or if files are into sub folder (use second script) ?

Thanks & regards
MM
MrMix
 
Posts: 13
Joined: Thu Mar 09, 2023 5:55 pm

Re: Rename files by adding part of folder name

Postby Admin » Tue Aug 05, 2025 3:56 am

That's nice! Great that it's working now.

How would the combined script know if the files are in the main folder or a sub-folder? If that is known then the last line can be modified conditionally with an if statement.
Admin
Site Admin
 
Posts: 3047
Joined: Tue Mar 08, 2005 8:39 pm

Re: Rename files by adding part of folder name

Postby MrMix » Thu Aug 07, 2025 4:47 pm

Admin wrote:How would the combined script know if the files are in the main folder or a sub-folder? If that is known then the last line can be modified conditionally with an if statement.

Good question but I don't have the answer ! At the moment I'll stay with two scripts.
Regards
MM
MrMix
 
Posts: 13
Joined: Thu Mar 09, 2023 5:55 pm

Previous

Return to How-To