Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename files based on text file

Status
Not open for further replies.

sylro

Technical User
May 19, 2007
31
0
0
RO
Hi all

Look, the situation is the follow: I have a folder, c:\folder1, containing 'n' .wav files and a text file, Log.txt.
Log.txt contains all the .wav files names plus other things (start_time, stop_time, duration).
The problem is to rename the .wav files with the corresponding lines from Log.txt (all the lines in the Log.txt correspond with the .wav files, one by one).

Initially I was thinking that a script to do this is not big deal but I realize that is only for professionals.
What are you saying? Could be a script to do all these?

Thanks in advance
sylro
 
Could you show a sample line from Log.txt and what the rules for renaming are?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
how is each line of the text file delimited (ie "name, start_time, end_time..etc")? are the files named like "1.wav" "2.wav" and the first line of the text file correspond to 1.wav and the second correspond to 2.wav? It would be a fairly straight forward script to do that.

PS don't post the same thread in more than one forum next time please
 
Thanks for your interest!

I uploaded the folder 'WavFolder.rar' at the address:


It contains 2 text files:
-'FileNames.txt' which has the original names of the files
-'Administrator_audfiles.txt' which is the log file; it contains all the information about the wave files that I need to overlap the original names.
I mean
from D:\wav\Administrator_WAV_10.wav
to D:\wav\Administrator_WAV_10_[Start Time]_[Stop Time]_[Phone Number]_[Channel].wav

The wave files and the log text files are contained together in the same folder (D:\wav\).

I need help to overcome this part with writing scripts.

Thanks in advance
sylro
 
Read the first file into an array.
Read the second file into an array.

Use the FileSystemObject to rename the files. A rename is done using the objFSO.Move function.



I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top