Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need a script for moving files with a specific format

Posted on 2013-06-05
4
Medium Priority
?
292 Views
Last Modified: 2013-06-05
I need a script that will scan an entire directory for every file with a .wav extention. Take that file and move it to a new location that I can specific like (C:Temp)

Any suggestions?

Thanks.
0
Comment
Question by:dowhatyoudo22
  • 2
  • 2
4 Comments
 
LVL 59

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 39222229
Do you want to preserve the file structure, or rather place all the files from the various subfolders into a single folder?  Here's a couple of approaches in one BAT file, use the one desired depending on the answer to this question.

@echo off
set BaseDir=c:\source
set DestDir=c:\temp

REM Use these two lines if you want to preserve folder structures
xcopy "%BaseDir%\*.wav" "%DestDir%" /S /I
del /S /Q "%BaseDir%\*.wav"

REM Use this line if you want to "flatten" all files to the dest folder
for /F "tokens=*" %%A in ('dir /S /B /A-D "%BaseDir%\*.wav"') do move "%%~A" "%DestDir%"

Open in new window

~bp
0
 

Author Comment

by:dowhatyoudo22
ID: 39222304
Thats exactly what I am trying to do. Currently the .wav files are scattered across hundreds maybe thousands of different subfolders. I need to grab them all and place them all in one folder. I do however need to keep the filenames in tact as they are descriptive towards the actual .wav file itself.
0
 

Author Closing Comment

by:dowhatyoudo22
ID: 39222694
worked perfectly. Thanks!!
0
 
LVL 59

Expert Comment

by:Bill Prew
ID: 39222809
Great, glad that was helpful, thanks for the feedback.

~bp
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question