26

(8 replies, posted in Evolution requests)

In the case that prompted me to make the suggestion there was a simple name pattern.
I had over 500 folders; each identified with just a nondescript number. Inside each folder was 1 to many files with a name and a number, just as in your example,  although the separator varied. Each folder is name segregated although there are duplicates across folders. The %nc variable would sort that out though.

Of course this is the most straightforward case. As I thought about it it seemed that if one approached the idea more generally there might be many variations.
Examples:
Rename folder based on first and last file in the folder
Rename based on earliest or latest date of files in the folder, or both.

I am not a Regex expert but it also seemed to me that if a folder contained a bunch of files that didn't fit a pattern but if each folder contained at least one file that did match a pattern that a multiline regex search could grab the desired info.

OK, That one's maybe a stretch.

But it seems to me that if you make it generic enough, who know what ways people will figure out how to use it?

27

(8 replies, posted in Evolution requests)

I looked around a bit. There's nothing I could find that does anything like this.

I would be interested in hearing what ideas you've got, if you want to kick it around a bit.

28

(8 replies, posted in Evolution requests)

Renaming files based on folder names is easy using %p and its variants.
Renaming folders based on the files in the folder is quite difficult.

ie:
pictures\1\bob01.jpg         -> pictures\Bob\bob01.jpg
pictures\2\mary01.jpg       -> pictures\Mary\mary01.jpg   
pictures\3\sam01.jpg        -> pictures\Sam\sam01.jpg

A variable that reported directory contents would be very useful here.
Something like %k{line,path,param,ext}
Where:
Line=Line # from dir command output (ie 1,2,-1,-2,etc) Default=1
Path=standard path specification Default=path of current selection
Param=standard DIR command parameters Default=/A:-d-h-s /B /On
Ext=File Extension On/Off Switch Default=OFF (ie. strip file extension from line)

Once the string was returned it would be fairly easy using standard operations to rename according to preference.
Using the above example with folders 1,2,3 etc selected
  %Uk(s/([a-z]+)\d.*/\1/i) would give the result shown, as would %Uk(1,-2), etc.

Line = 0 could return entire dir command output for parsing by regex.

29

(3 replies, posted in How to ...)

The help file gives the following example:
From :                 To:
Img1.jpg             Img_001.jpg
Img2.jpg             Img_002.jpg
Img10.jpg           Img_010.jpg

Use the expression :
Img_%N.%e or Img_%N{3}.%e

The following expression will work with any filename which has # at end of the name:
%b(s/(\d+$)//i)%N{3,,-1}.%e

Example:
anyfilename-2.jpg                =>  anyfilename-002.jpg
Any.filename34.jpg              =>  Any.filename034.jpg
Any17_filename_12.jpg       =>  Any17_filename_012.jpg

Obviously use any desired values in the %N expression.

To add a separator, put desired character between the RegEx  & the %N:
%b(s/(\d+$)//i)_%N{3,,-1}.%e
%b(s/(\d+$)//i)-%N{3,,-1}.%e

To remove a separator, put undesired separator before the \d:
%b(s/(_\d+$)//i)%N{3,,-1}.%e
%b(s/(-\d+$)//i)%N{3,,-1}.%e

To change the separator, do both (note: there is a space between _ and ~)
%b(s/([-_ ~.]\d+$)//i)_%N{4,,-1}.%e
ie:
Filename-1.jpg         =>   Filename_0001.jpg
Filename_20.jpg       =>  Filename_0020.jpg
Filename 300.jpg      =>  Filename_0300.jpg
Filename~4000.jpg   =>  Filename_4000.jpg
Filename.050.jpg      =>  Filename_0050.jpg

Imagevenue annoyingly corrupts original filenames by appending a random#_ prefix and a suffix beginning with _123 or _122.
You get something in the form: #######_filename_123_###lo_###_###.jpg. The following expression will extract the original name.

%b(s/(.*?)_(.*)_12[23](.*$)/\2/i).%e

If the random # prefix has already been removed, the following will remove just the suffix:

%b(s/(.*)_12[23](.*$)/\1/i).%e

This works even when the filename includes _123 but breaks down if one of the 3 digit random #'s after the _123 is another _123. In that case just run the file again with the second expression.

Examples:
27053_1962_Calendar_12.Janet_Pilgrim_123_1175lo_460_345.jpg  =>  1962_Calendar_12.Janet_Pilgrim.jpg
0220965_1964-04_123_PMs_Revisited.1956_123_1041lo.jpg  =>  1964-04_123_PMs_Revisited.1956.jpg

But:
89930_cal._1960_05.Janet_Pilgrim_123_835lo_123_456.jpg  =>  cal._1960_05.Janet_Pilgrim_123_835lo.jpg
Run again with 2nd expression:
cal._1960_05.Janet_Pilgrim_123_835lo.jpg  =>  cal._1960_05.Janet_Pilgrim.jpg

Hope someone else finds this useful!

btw nice program

31

(0 replies, posted in How to ...)

The help file gives the following example:
From :                 To:
Img1.jpg             Img_001.jpg
Img2.jpg             Img_002.jpg
Img10.jpg           Img_010.jpg

Use the expression :
Img_%N.%e or Img_%N{3}.%e

The following expression will work with any filename which has # at end of the name:
%b(s/(\d+$)//i)%N{3,,-1}.%e

Example:
anyfilename-2.jpg                =>  anyfilename-002.jpg
Any.filename34.jpg              =>  Any.filename034.jpg
Any17_filename_12.jpg       =>  Any17_filename_012.jpg

Obviously use any desired values in the %N expression.

To add a separator, put desired character between the RegEx  & the %N:
%b(s/(\d+$)//i)_%N{3,,-1}.%e
%b(s/(\d+$)//i)-%N{3,,-1}.%e

To remove a separator, put undesired separator before the \d:
%b(s/(_\d+$)//i)%N{3,,-1}.%e
%b(s/(-\d+$)//i)%N{3,,-1}.%e

To change the separator, do both (note: there is a space between _ and ~)
%b(s/([-_ ~.]\d+$)//i)_%N{4,,-1}.%e
ie:
Filename-1.jpg         =>   Filename_0001.jpg 
Filename_20.jpg       =>  Filename_0020.jpg
Filename 300.jpg      =>  Filename_0300.jpg
Filename~4000.jpg   =>  Filename_4000.jpg
Filename.050.jpg      =>  Filename_0050.jpg

Imagevenue annoyingly corrupts original filenames by appending a random#_ prefix and a suffix beginning with _123 or _122.
You get something in the form: #######_filename_123_###lo_###_###.jpg. The following expression will extract the original name.

%b(s/(.*?)_(.*)_12[23](.*$)/\2/i).%e

If the random # prefix has already been removed, the following will remove just the suffix:

%b(s/(.*)_12[23](.*$)/\1/i).%e

This works even when the filename includes _123 but breaks down if one of the 3 digit random #'s after the _123 is another _123. In that case just run the file again with the second expression.

Examples:
27053_1962_Calendar_12.Janet_Pilgrim_123_1175lo_460_345.jpg  =>  1962_Calendar_12.Janet_Pilgrim.jpg
0220965_1964-04_123_PMs_Revisited.1956_123_1041lo.jpg  =>  1964-04_123_PMs_Revisited.1956.jpg

But:
89930_cal._1960_05.Janet_Pilgrim_123_835lo_123_456.jpg  =>  cal._1960_05.Janet_Pilgrim_123_835lo.jpg
Run again with 2nd expression:
cal._1960_05.Janet_Pilgrim_123_835lo.jpg  =>  cal._1960_05.Janet_Pilgrim.jpg

Hope someone else finds this useful!


btw nice program