Renaming Wav files

Closed
kardiva - Mar 31, 2010 at 07:34 AM
Richard.Williams Posts 25 Registration date Saturday November 7, 2009 Status Member Last seen July 18, 2012 - Apr 26, 2010 at 04:05 PM

How do i rename a file have file name as :

AudioOnly_Site_-01_AudioModule_01_AudioChannel_65_29-Mar-2010_10.34.52.400.WAV

to

2010.03.29.10.34.52.400_01_65.wav

Kardiva :-)
Related:

4 responses

Richard.Williams Posts 25 Registration date Saturday November 7, 2009 Status Member Last seen July 18, 2012 14
Apr 26, 2010 at 04:05 PM
Try this biterscripting script.

If the _ were to word separator, you want the 8th, 9th, 3rd and 7th word.


# Script RenameWav.txt
var str dir, list, path, name, newname
var str w8, w9, w3, w7
set $wsep="_"                                       # Set the word separator
cd $dir ; lf -r -n "*.WAV" > $list
while ($list <> "")
do
    lex "1" $list > $path ; stex -p "^/^l[" $path > $name
    wex -p "8" $name > $w8
    wex -p "9" $name > $w9
    wex -p "3" $name > $w3
    wex -p "7" $name > $w7
    set $newname = $w8+"_"+$w9+"_"+$w3+"_"+$w7+".WAV"
    system rename ("\""+$path+"\"") ("\""+$newname+"\"")
done



Copy and paste script code in file C:/Scripts/RenameWav.txt, start biterscripting, use this command.


script "C:/Scripts/RenameWav.txt" dir("C:/test")


It will rename all .WAV files under folder "C:/test" accordingly.

I don't think this script is perfect, so please test it first on a test directory. I have not been able to test it.
1
I have more than 500 files to named as such on a daily basis "F2" will will be time consuming.

Kardiva:-)
0
closeup22 Posts 8923 Registration date Friday May 15, 2009 Status Member Last seen October 7, 2010 2,099
Mar 31, 2010 at 08:00 AM
Hi there,

select the file,then press F2 to rename or right click on it and select rename and enter the mentioned name.

Thanks
-1
I have more tha 500 files to be remaned "F2" will be time sonsuming.

Kardiva :-)
0
@echo off
for %%i in (*.Wav) do (set fName=%%i) & call :10
goto :eof
:10
@echo off
for %%i in (*.Wav) do (set a=%fname:~31,2%) & call :20
:20
set b=%fname:~47,2%
set c=%fname:~50,11%
set d=%fname:~62,12%
ren %fName% %c%.%d%_%a%_%b%.wav
pause


This returns the file name as "29-Mar-2010.10.29.32.400_01_46.wav"

whet Do i do if i want to convaer the mar to 03

Kardiva:-)
-1
And for some reason I need to press a key to select the next file if i add exit at the end the bat dont work

Any sugesstion

Kardiva:-)
0