Conditional Batch file renaming with mysql data

Posted by Paul Stevens on Stack Overflow See other posts from Stack Overflow or by Paul Stevens
Published on 2010-06-17T02:48:10Z Indexed on 2010/06/17 2:52 UTC
Read the original article Hit count: 215

Filed under:
|
|
|
|

Hello,

I wonder if anyone knows how could I rename multiple files, all of them originally named with same structure, and add some data extracted from a mysql DB according to specifics rules.

For example I have 500 files named with this vars:

ID NAME ADDRESS PHONE.wav => 1234567 PAULSIMON WESTDR122 9942213456.wav

Now I need to rename files taking some data from the databases for each file, and append the data from a query appended to the filename.

For example add the data resulting from a query Where some conditions match, and the data to build the query is taked from original file name, as ID or NAME.

i other words, lets say that I want to build a query taking ID & NAME from file 1234567 PAULSIMON WESTDR123 9942213456.wav as WHERE statements to take another value as BirthDATE and add this to new filename, so final result should be:

ID NAME ADDRESS PHONE BIRTHDATE.wav

I will appreciate any help on this.

I need this to be done on a LINUX server.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about linux