How to move mp3 files from my server

I want to find and move all the mp3 files from a server volumne.  These files are within many subfolders.  How can I do this? Use DOS - MOVE?  I don't want to COPY, I want them off of the current volume, but don't want to delete them (yet)

Who is Participating?
Shift-3Connect With a Mentor Commented:
Paste the script below into a text file with a .cmd extension.  Customize the value of the source variable on line 4 with the location of the directory to search under.  Customize the value of the dest variable on line 5 with the location to move the files to.

Running the script will echo the commands to be run.  Once you have tested it successfully, remove the word ECHO from line 10 to move the files.

The advantage of this script is that it preserves the folder tree so that you know where each file came from and don't have to worry about duplicate names.

@echo off
set source=\\server\share
set dest=c:\music
set mask=*.mp3
for /F "tokens=*" %%G in ('dir "%source%\%mask%" /A:-D /B /S') do (
 if not exist "%dest%%%~pG" md "%dest%%%~pG"
 ECHO move "%%G" "%dest%%%~pG"

Open in new window

The method I used for a similar task is to use Windows Search to find "*.mp3; *.wma;" (and other music file types if necessary) and sort by folder (so I don't copy any game music or other useless files) and then start selecting (hold ctrl to select multiple files, hold shift to select a series of files) and copy/cut & paste.
I don't know how to do it in one command but you can try:
xcopy /s src\*.mp3 dst
del /s src\*.mp3

or maybe you can do it with a power shell command
The MOVE command automatically deletes the source, so if you don't want to delete the source files, steer clear of the move command.

I personally use a program called Foldermatch to move a large number of files, directories, etc. around. It has so many other features that you might review how you do backups, how to test if files are the same (compare), and how to keep directories from a source location and a target location in sync. It also has duplicate checking.

The key is that it deals with directories and/or files.

At least take a look at it  I don't have anything to do with the outfit that makes the program but I paid the shareware fee a couple of years ago and never regretted it. I use it for exactly the kind of task you are describing.

You also have the opportunity to review what it will do before it does any moving, copying, etc., something a DOS solution doesn't do well, or at all.

ejcristAuthor Commented:
Thanks a bunch...that worked geat!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.