Topic: Add parent folder name to filename
Q: Hello, i want to remove the file name
and add the name of the parent folders
following by an counter, reseted by each new folder, if this is possible.
F.ex.
C:\Work\Project\Jan\list.txt ==> Work_Project_Jan_001.txt
C:\Work\Project\Jan\report.txt ==> Work_Project_Jan_002.txt
C:\Work\Project\Feb\list.txt ==> Work_Project_Feb_001.txt
C:\Work\Project\Feb\report.txt ==> Work_Project_Feb_002.txt
A: That's easy.
1) load your main folder "Work" with "Choose Current Dir"
2) load all sub-directories with Ctrl+F5 "Load sub dirs"
3) use an Expression like: %p3_%p2_%p1_%np{ 3, 1, 1 }
Explanations:
%p : a parent directory, a digit can indicate the level [%p1 is parent folder "Jan", %p2 is grand-parent folder "Project", %p3 is "Work"]
%np : the selection number relative to the file path
%np could be modified by { p, s, i }
p : size, f.ex 3 => 000, 5=> 00000
s : start
i : step
-------------------
Press "F1" in Siren for more help. (Help is search-able by pressing "Ctrl+F")
%p : a parent directory
a digit can indicate the level
%pa : the absolute path to the file (ending with a '\')
%pr : the relative path to the file (ending with a '\')
%P : Siren's current path
For example, for "C:\IMAGE\SPORT\2006\IMG001.jpg"
%p gives "2006"
%p2 gives "SPORT"
%p3 gives "IMAGE"
In non recursive mode:
%pa gives "C:\IMAGE\SPORT\2006\"
%pr gives "" (empty string)
%P gives "C:\IMAGE\SPORT\2006\"
In recursive mode, if Siren's current directory
is "C:\IMAGE":
%pa gives "C:\IMAGE\SPORT\2006\"
%pr gives "SPORT\2006\"
%P gives "C:\IMAGE\"
%n : the selection number
%np : the selection number relative to the file path
for example:
File %n %np
\Dir1\Img1.jpg 001 001
\Dir1\Img2.jpg 002 002
\Dir2\Img3.jpg 003 001
\Dir2\Img4.jpg 004 002
%nc : the selection number relative to a name "collision"
(same beginnings)
the expression part following "%nc" is not taken into
account.
for example, with the expression: %dmd_%nc.%e
File Modif date Result
Image1.jpg 01/01/2004 20040101_001.jpg
Image2.jpg 12/12/2004 20041212_001.jpg
Image3.jpg 01/01/2004 20040101_002.jpg
Image4.jpg 12/12/2004 20041212_002.jpg
Image5.jpg 12/12/2004 20041212_003.jpgThe parameters of some "number" variables can be defined in
"Options" ("Numbers" sub-menu). They can be specified too direclty
in the expression inside a "{}" modifier (braces) that postfixes
the variable name.For the selection numbers: %n, %np, %nc, %ncs, %ncf and %ncfs
the usage is: "{ p, s, i }"
p : size
s : start
i : step
There's much more in Siren Help...
.