Topic: Rename by content

Hi, thank you for the great software. It's a little bit user un-friendly at the beginning, but REALLY powerful, I've never seen anything like this before!
I was trying to rename some files from my nokia pc suite: old versions used to output only an incremental message number, newer version outputs sending phone number and date and time the message was received. I'd like to rename everything so to be consistent.

00020003.vmg --> +393212345678_2006-06-23.vmg

Since the SMS are exported as text files, it shouldn'be that hard to tell Siren to extract line 8 and line 18 and rename files this way. The "refining" part (deleting TEL: and date:) shouldn't be that big problem.

The file content looks like this:
Date:23/06/2006 15.16.28
Ciao ciao ciao

The matter is: how can I tell siren to extract the lines from each file? It looks like that it does need a single external file to work...
Thank you so much for help!

Re: Rename by content

Hi fprevos and welcome to the forum.

I am not sure if this is possible, i have to think off ;-) (maby later the evening)

There is already an nice option in Siren to extract an line of text from an given file...
... but not relative to the current file, only absolute to an defined file.

%T   : line extracted from a text file following the file
          selection order.
          a digit can indicate an absolute line number
          The file name is specified between '{' and '}'.
          As the character '\' is an escape character, the ones
          present in the paths have to be doubled.
          Not indicating a file name is equivalent to referencing
          the one previously named. There is no limit to the
          number of files that can be used in an expression.
          Fic_%T{"C:\\temp\\fa.txt"} - %T1 - %T{"D:\\fb.txt"}.txt

Your're right, would be nice to have something like %T{"%fa"}
( %fa means actual file with full path)

I will check out later if this is possible, maybe Rémi cames later along too.

Re: Rename by content

Hello and welcome !

fprevos wrote:

It's a little bit user un-friendly

Thanks for the euphemism wink

Your request points out at least two limitations of the %T variable:
- The associated text file name has to be a constant
- The absolute line number to extract can only be one digit long (< 10)

Based on this, one way to solve your issue is to generate appropriate text files before usage.
You'll have to deal with the DOS command prompt ...
The first idea that comes to my mind is to create two text files:
- "tel.txt" containing the phones numbers
- "date.txt" containing the SMS reception dates/times

The line orders have to follow the alphabetical file names orders.

To achieve this you can execute the following commands:
findstr /C:"TEL:+" *.vmg > tel.txt
findstr /C:"Date:" *.vmg > date.txt

Then you can start Siren and apply to your files an expression like:
%T{"tel.txt"}[3,":"]_%T{"date.txt"}[3,"/ "]-%T[2,"/"]-%T[3,"/:"].*

This seems to work under Vista.

Hope this will help.

Re: Rename by content

Worked beautifully, thank you so much!
I had a little problem because files were encoded in Unicode LE, so I had to struggle for a while to make findstr work, but at the end I managed! I also did some text editing before using the suggested string in Siren, hence my rename mask was simplier.
By the way, beautiful software, and no euphemism, it's only a matter of time: the help file is very clear and since what I wanted to do was very specific I could spend a few minutes to understand how a software works! (or maybe once you need some unix and you struggle with vi everything seems so easy!!)
Thank you again for the very fast reply!