Solved

Need a script for moving files with a specific format

Posted on 2013-06-05
4
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 56

Accepted Solution

by:
Bill Prew earned 500 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 56

Expert Comment

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

~bp
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 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