Renaming files using a part of the original path
|Jean-Pierre Compain||09/15/2006 01:12 pm|
|I need to regroup scanned files, downloaded into numerous subfolders, but using the same sequential generic name created by scanner and cameras.
Grouping files right away would overwrite them.
I need to identify each file with its original name AND the origin which would use a part of the path each file is originated from.
I want to rename my files, when downloading, using 1 or more part of the original path. It is then a variable as each file will be named after its own path. It is especially usefull when you download numerous projects with various pathes, and want to add this to a default template for all.
example: .../golf/UK/StEnodoc/scan001.jpg and .../golf/UK/WestCorwal/scan001.jpg
would become: .../golf/UK/StEnodoc/UK-StEnodoc-scan001.jpg and .../golf/UK/WestCorwal/UK-WestCornal-scan001.jpg
or: .../golf/UK/StEnodoc/StEnodoc-scan001.jpg and .../golf/UK/WestCorwal/WestCornal-scan001.jpg
I found nothing about this in this forum, "Using URL Macros", "URL substitutes"
Is it possible?
What should be the pattern used into the URL substitute screen?
|Oleg Chernavin||09/15/2006 03:33 pm|
|What about the following URL Substitutes rule:
|Jean-Pierre Compain||09/16/2006 12:44 pm|
|It almost works! But it only does if a part of the path is known, is a constant (and in a constant position in the path) and written "in hard" as you did in your example (/golf/UK).
If I write URL: *.jpg Replace:/3/**/*/ With:/3/**/*/*- (URL box not checked) I get: 3/2/1/1-x.jpg
If I write URL: *.jpg Replace:/3/**/*/ With:/3/**/*/**- (URL box not checked) I get: 3/2/1/2-x.jpg
If I write URL: *.jpg Replace:/3/**/*/ With:/3/**/*/**-*- (URL box not checked) I get: 3/2/1/2-1-x.jpg
Everything is fine up till now and this already a result!!
BUT, as soon as the path is relative, nothing works!
Example: if the URL is not anymore http://3/2/1/x.jpg but is http://3/3bis/2/1/x.jpg, or is http://5/3/4/2/1/x.jpg, my rule crashes and the file is not renamed.
If I write (relative )URL: *.jpg Replace:/**/*/ With:/**/*/*- (URL box not checked) I still get: x.jpg (nothing changed)
How can I select independently from the path and its length or number of folders, the folder BEFORE the file, and/or the folders at a level higher ex. in http://(whatever is in front)/3/2/1/x.jpg, be able to add 3 and/or 2 and/or 1 with 3/2/1 being variables.
For testing and illustrating what I mean, I have uploaded a small set of test files accessible from http://www.compain.com/index.htm . I tried without success to apply a common rule for the links on this page in order to add one of the last 3 part of the path without depending on the length and naming of the folders. Only the position of the folders is important, not the name.
|Oleg Chernavin||09/20/2006 08:43 am|
|What about a rule like: