#1 2021-11-09 15:58

adiosdonut
Member
Registered: 2021-11-09
Posts: 6

How to insert name of folder one level up?

When I want to rename a file and insert the name of the containing folder in the file name I use this:
:File_FolderName:

What if I want to insert the name of the folder one level up. In other words I want to insert the name of the folder that contains the subfolder where the file resides?

Can that be done?

EDIT: I noticed some threads in the forum asking similar questions, and it seems that it can be done using a Pascal Script. I have very basic coding skills and even after reading those threads, I'm still not sure how to use such a script in ReNamer to get the results I need.
If anyone has a couple of minutes to coach me through this, it would be much appreciated smile

Last edited by adiosdonut (2021-11-09 17:14)

Offline

#2 2021-11-09 22:38

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: How to insert name of folder one level up?

There are a few different ways of achieving this, each differs by taste.

Here are a couple:

Method A

Insert the ":File_FolderPath:" meta tag and then use other rules, like the Regular Expressions, to remove the parts you don't want.

Method B

A pascal script:

begin
  FileName := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))) + ' - ' + FileName;
end.

For the reference:
https://www.den4b.com/wiki/ReNamer:Pascal_Script

Offline

Board footer

Powered by FluxBB