Solved

Need a script for moving files with a specific format

Posted on 2013-06-05
4
285 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 53

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 53

Expert Comment

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

~bp
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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