Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Ok, here's probably a tricky one...
I have a drive that has data on it, which is organized into two file types, a .wav and a .ifo. The files are in folder schemes based on the channel, and the date, so the location of a file for today on channel one could be D:/001/08302007/filename.ifo.
What had happened is someone cut all the wavs off the drive, and put them all into 1 folder, by searching the drive for *.wav, then pasting all the results in one folder.
Now….. we need to put all the files back onto the drive for them to be restored, pairing the .wav back with the .ifo. They're named the same, for example one pair is ")TK!%XCD.ifo" and “)TK!%XCD.wav”.
The reason why this is tricky to do by hand is since we have about 30 channels, and 3 months of data, there are over 250,000 files in about 25,000 folders. So instead of taking the file name, searching the folder where all the wav’s got cut to (prelogbak), then cutting the wav into the folder 250,000, it would be nice to have a program that could do this for me.
What I would like to do is have a batch file that would go through and look at what .ifo files are in a folder, then go to the folder with the wav files "C:/prelogbak" and copy the matching .wav file into the folder with the .ifo.
So it would go into D:/001/08302007/ and see D:/001/08302007/filename1.ifo, then go search C:/prelogbak for filename1.wav. When it finds it, it pastes filename1.wav in the same folder with filename1.ifo. Then it goes on to all the other files and folders, etc.
If this cant be done, I'd settle for a batch file that could do a dir of the ifo files, then take of the extension so I could drop it into a search, so instead of having
File1.ifo
File2.ifo
File3.ifoI’d rather have
File1, File2, File3.Sorry for the tall order :D.
-Brian

It's untested, so take it for what it's worth:
FOR /R C:\ %a IN (*.ifo) DO MOVE "C:\prelogbak\%~Na.wav" "%~DPa"If you're still having problems, tell me what error it's throwing. If I'm not around, look for Mechanix2Go. He's probably the best command line scripter here. Oh, that CANNOT be run from a batch file/command script as posted. It'll only work from the Command Prompt.

Seems to be working like a charm!
I'll keep updating with... updates :D.
If i could be so bold, could you break down the string a little bit so I can understand the components? That way if i have to modify it i dont have to bug you guys :).
Thanks!
-Brian

Well, you COULD research it yourself.
FOR /?
MOVE /?But basically, it breaks down like this:
FOR /R C:\ %a IN (*.ifo) DO
Search for *.ifo files.FOR /R C:\ %a IN (*.ifo) DO
Start searching in C:\, and do all subdirectories. (Basically, search the entire drive.)MOVE "C:\prelogbak\%~Na.wav" "%~DPa"
Move the .WAV file in C:\prelogbak, which has the same base name as the .IFO file we found...MOVE "C:\prelogbak\%~Na.wav" "%~DPa"
...to wherever that .IFO file is.

Razor2.3,
That's pretty slick, slick. Much cleaner than my approach. LOL
Brian,
As you tinker and learn, note that the path delimiter in DOS and windows is \ NOT /.
=====================================
If at first you don't succeed, you're about average.M2

Slick indeed.
Say, how does these lines work?
~Na.wav" "%~DPa"(Where does Na and DPa come from? Also, how does %~xxx work?)

Research it for myself?!
What sort of crazy talk is that??!
Hahaha, thank you very much again, it's still running, but everything is looking fantastic :D.

shroom,
Look at for /?
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |