Migrate Files to Parent Directory

February 28, 2013 at 14:24:59
Specs: Windows
Ok, here goes:

I work for an audio recording company. As such, there are times we need to upgrade a client's recorder and migrate all the old call data to the new system. Easy enough right? The directories are layered like so:

1: Parent Directory
2: Station Directories
3: Call Date Directories
4: Data Files (Two file types per call)

Now, the file structure in a new vs old machine is identical, however, the software is designed a bit counter-intuitive. It requires all the Data Files (bottom directory) to be dragged into a single folder and then the software integrates them into a new index and moves them to the proper folders. If I cut and paste them it won't know they are there and the calls can't be accessed.

What I am looking for is some sort of batch script I can drop into the Parent Directory of the old machine, pull all the data files to the top, then I can move them over to the indexing directory on the new machine.

I have tried, of course, searching the file types in windows, but there can be up 50,000 or so calls total in one phone directory. Needless to say older versions of Windows give me hell over that many file matches.

My biggest issue is that the directory names are never the same from site to site, so while they would match on a new vs old machine, they are different from customer A to customer B so I need a script that does not rely on specific directories.

Clear as mud, I know, but if anyone could help me out it would be AMAZING. I have been using a CMD String that works pretty well, but I can't figure out how to take that string and make it a .bat to share with my fellow employees.

CMD STRING: (From Parent Directory)
for /r %i in (*) do @move "%i" .

See More: Migrate Files to Parent Directory

February 28, 2013 at 18:16:27
if the file's extensions (2 types) are unique to the bottom levels:
@for /f "tokens=*" %%a in ('dir /b /s *.aaa *.bbb') do copy %%a .
::==== end
but I don't know what the extensions are. Something tells me there will be much more down the road from here.

Report •

February 28, 2013 at 23:58:26
:: ===== script starts here ===============
:: switch.bat 2013-03-01 14:55:45.12
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
echo move "%%a" ..
goto :eof
::====== script ends here =================

Report •

March 1, 2013 at 06:45:22

The files at the bottom level are .wav and .dat, I assume these extensions go into the .aaa .bbb ?

And thank you!

Report •

Related Solutions

March 1, 2013 at 06:49:59


Report •

Ask Question