Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Batch File Search and Paste

Original Message
Name: BrianSierakowski
Date: August 30, 2007 at 13:25:08 Pacific
Subject: Batch File Search and Paste
OS: 2000
CPU/Ram: p3, 256 ram
Model/Manufacturer: Proprietary recording mac
Comment:
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.ifo

I’d rather have
File1, File2, File3.

Sorry for the tall order :D.

-Brian


Report Offensive Message For Removal


Response Number 1
Name: Shr0Om
Date: August 31, 2007 at 03:02:42 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
You dont have any backup you could restore??

Report Offensive Follow Up For Removal

Response Number 2
Name: Razor2.3
Date: August 31, 2007 at 03:27:20 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 3
Name: BrianSierakowski
Date: August 31, 2007 at 04:12:13 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
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


Report Offensive Follow Up For Removal

Response Number 4
Name: Razor2.3
Date: August 31, 2007 at 05:27:19 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 5
Name: Mechanix2Go
Date: August 31, 2007 at 05:49:01 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
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



Report Offensive Follow Up For Removal


Response Number 6
Name: Shr0Om
Date: August 31, 2007 at 06:25:28 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
Slick indeed.
Say, how does these lines work?
~Na.wav" "%~DPa"

(Where does Na and DPa come from? Also, how does %~xxx work?)


Report Offensive Follow Up For Removal

Response Number 7
Name: BrianSierakowski
Date: August 31, 2007 at 07:22:05 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 8
Name: Mechanix2Go
Date: August 31, 2007 at 07:23:01 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
shroom,

Look at for /?


=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 9
Name: Shr0Om
Date: August 31, 2007 at 13:19:15 Pacific
Subject: Batch File Search and Paste
Reply: (edit)
Mechanix2Go: Aah.. Expanding full path..
Thnx:)

Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch File Search and Paste 

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




Slow boot time

Trasnferring Documents from old HD

My k8T Neo-v usb's aren't working!

Date Modified = Date Created Time

system files on removable harddrive


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC