Renamer Plugin: add parent name

We welcome any suggestions for new features or improvements in Altap Salamander. Please post one suggestion per report.
User avatar
AbteriX
Posts: 94
Joined: 12 Mar 2006, 20:55
Location: Deutschland
Contact:

Renamer Plugin: add parent name

Post by AbteriX »

How can i add in file renamer the name of the parent folder?
e.g.
C:\Work2006\DoTo.txt
C:\Work2006\Work2006-DoTo.txt
$(RelativePath)-$(Name)

$(Drive) , $(Path) , $(RelativePath) didn't seams to work here.



Tip:
with "Options\Rename ...Path"
we can rename AND move. (i never have seen this bevor)
"D:\Old\$(Name)" ...moves NAME to D:\Old\

Request:
how can i COPY instead of move?


Bug ?:
"Options\Rename Full Path"
i get an error message : ~ "Can not case modify folder name" (or like that)
"Change Case:" is at [Don't change]
Petr Solin
ALTAP Staff
ALTAP Staff
Posts: 1112
Joined: 08 Dec 2005, 09:13
Location: Novy Bor, Czech Republic
Contact:

Re: Renamer Plugin: add parent name

Post by Petr Solin »

AbteriX wrote:How can i add in file renamer the name of the parent folder?
e.g.
C:\Work2006\DoTo.txt
C:\Work2006\Work2006-DoTo.txt
$(RelativePath)-$(Name)

$(Drive) , $(Path) , $(RelativePath) didn't seams to work here.
-select subdirectories which content you want to rename in panel
-start Renamer (Shift+Ctrl+R)
-select Include subdirectories
-select Options/Rename Relative Paths (or Rename Full Path)
-select Regular Expression
-type in Search for: ([^\\]+)\\([^\\]+)$
-type in Replace with: $1\$1-$2
AbteriX wrote:Tip:
with "Options\Rename ...Path"
we can rename AND move. (i never have seen this bevor)
"D:\Old\$(Name)" ...moves NAME to D:\Old\

Request:
how can i COPY instead of move?
Please separate this to another topic.
AbteriX wrote:Bug ?:
"Options\Rename Full Path"
i get an error message : ~ "Can not case modify folder name" (or like that)
"Change Case:" is at [Don't change]
Please separate this to another topic under Bug Reports. And add more details.
Lukas Cerman
Plugin Developer
Plugin Developer
Posts: 36
Joined: 11 Dec 2005, 20:08
Contact:

Re: Renamer Plugin: add parent name

Post by Lukas Cerman »

-type in Search for: ([^\\]+)\\([^\\]+)$
to explain this regular expression:

[^\\]+ stands for path component, you can add it from the regular expression menu (to the right of the `Search for' field)

\\ stands for backslash

$ stands for end of filename

terms in brackets are captured in the internal variable which can be referenced from `Replace with' form usin dollar expression -- $1 for first captured portion and $2 for the seccond
Request:
how can i COPY instead of move?

Please separate this to another topic.
this quite often requested feature, we have it on our todo
Petr Solin
ALTAP Staff
ALTAP Staff
Posts: 1112
Joined: 08 Dec 2005, 09:13
Location: Novy Bor, Czech Republic
Contact:

Post by Petr Solin »

Only for selected files (instead of whole subdirectories) in panel:
-start Renamer (Shift+Ctrl+R)
-select Options/Rename Full Path
-select Regular Expression
-type in Search for: ([^\\]+)\\([^\\]+)$
-type in Replace with: $1\$1-$2
User avatar
AbteriX
Posts: 94
Joined: 12 Mar 2006, 20:55
Location: Deutschland
Contact:

Post by AbteriX »

Thank you very much for the answers and the regex's.

Today
$(Drive) , $(Path) , $(RelativePath) seams to work here.
Or i have choosen an other option from options menu then yesterday<?>

Image
I have done this with Options|Rename Full Path
and get an error msg on Rename of course. That's OK.

If we could use this
$(Drive) , $(Path) , $(RelativePath) tokens
with Options|Rename Filenames too
we can add this parent folder names with out regex.

Image

But we need then an renamer option "exchange unallowed chars"
like i have done with regex in the test above (\=-, :=-)
I will request this in an another thread.


BTW
the meaning/caption
of "Path" and "Relative Path" is
vice versa exchanged.
i.e.
For $(Path) i get \tmp\xy.exe
For $(RelativePath) i get D:\tmp\xy.exe
AbteriX
Post Reply