Topic: Apply date modifiers on a substring of the file name

Hello,

I'm new to the forum, but I use Siren for quite a long time now. First of all I want to thanks
the author for this excellent file renamer (the best I found).

I use Siren to copy/rename my pictures and normally use the EXIF date to put them in folder
patterns like that:

  basefolder\yyyy\mmMonthName\modified_picture_name

basefolder is a constant string, yyyy is the picture's year and mmMonthName is picture's month
(01January, 02February, ...). The modification on the picture's name is not relevant here.

The tricky part was (for me) to define the mmMonthName; after some tries I found
   %Xdo{

2 (edited by apalou21 2016-02-22 16:47:51)

Re: Apply date modifiers on a substring of the file name

Oups, looks like posts are limited in size.

[...]
%Xdo{"%m"}%@UXdo{"%B"} did the job.
Unfortunatelly I got pictures without EXIF date, but with a file name like 20150227_blabla.jpg

I tried %b(1,8){"%m"}%@Ub(1,8){"%B"} but it failed (of course date modifiers work only on variables).

Could you implement date modifiers on substring in order the expression here above work?

Thanks

Re: Apply date modifiers on a substring of the file name

Hello and welcome to this forum,

Your request is interesting but would require too much changes for now.
In the mean time you can do it another way :

1) Create a text file containing the months names.
I created : "d:\check\month.txt" containing the lines (of course you can use the name and location you want, just update the expression accordingly) :
January                        
February                 
March                 
April
May
June
July
August       
September
October
November
December

2) Use the following expression :
To rename the files with names begining with a YYYYMMDD date :
%b(7,2)%T{"d:\\check\\month.txt",%b(5,2)}

Here is a quick explanation with the file "20040214_garden.jpg" :
%b(7,2) gives the day : 14
%b(5,2) gives the month : 02
%T{"d:\\check\\month.txt",%b(5,2)} is interpreted as %T{"d:\\check\\month.txt",02} giving the 2nd line of the "month" file : February
The final result will be : 14February
Siren's help should give you more details about the "%T" veriable and the modifier parameter substitution.

If you want to rename "Exif" and "YYYYYMMDD" files in a single pass here is a trickier expression (if needed I'll explain it) :
%Xdo{"%m"}(s/^$/#/)("#",%b(7,2))%T{"d:\\check\\month.txt",%Xdo{"%B"}(s/^$/#/)("#",%b(5,2))}

Hoping this will help.

Re: Apply date modifiers on a substring of the file name

Hello Rémi,

Thanks for your answer. I was able to do it with adjunction of the text file, but found it
less elegant ;-) Your solution in "one pass" is really interesting and tend me to propose
you to implement a conditional expression.

Thanks again and I hope you will continue to develop this great software.

Re: Apply date modifiers on a substring of the file name

You are right. This is not very nice but not that ugly neutral.

About the next version, I am still working on it. Siren 3.15 is on its way but far from finished.
It might include a feature that could help on the "conditional" expression problem.
You can have a look at it there : Opinion on new feature : expression filters

Re: Apply date modifiers on a substring of the file name

Hello Rémi,

I know it's long time since last post in this thead and I apologie for that. I decided to post here because my new suggestion is linked to the usage described here.
Since my last post, I switched to Linux and was really happy to see Siren also working on that system. The problem I face now is my system language is in english and even if I put Siren in french, %@UXdo{"%B"} gives me the month name in english. It would be great if we can force the language to use with that expression.

Once again thanks for that excellent software and I hope the 3.15 will soon be available ;-)

Re: Apply date modifiers on a substring of the file name

Hello,

This date conversion feature uses a system function which uses the current system locale.
On GNU/Linux it is quite easy to overcome this.
First you have to install the "french" package then set the current language environment variable to french before starting Siren.
In you case, in a terminal, if you current directory is Siren's one :
LANG=fr_FR.UTF-8 ./siren

Regarding version 3.15, I am currently dedicating nearly all my free development time to MaTéléFree.
Siren is not dead smile

Regards