Avatar of zimmer9
zimmer9
Flag for United States of America asked on

How to copy MP3 files existing in seperate source directories into 1 target directory? I have WIndows XP on my PC.

Is there a DOS command I can issue to copy MP3 files existing in seperate source directories into 1 target directory ? I have WIndows XP on my PC.

I have directories with names that all start out with
D:\MyDocuments Are Here\My Musci\Something-newest\:

For example:

D:\MyDocuments Are Here\My Musci\Something-newest\3 Doors Down\Away From The Sun\

D:\MyDocuments Are Here\My Musci\Something-newest\Usher\Raymond vs Raymond\

D:\MyDocuments Are Here\My Musci\Something-newest\Usher\Unknown Album\

D:\MyDocuments Are Here\My Musci\Something-newest\Usher\New James.net\

D:\MyDocuments Are Here\My Musci\Something-newest\The Zombies\Unkonw Album\

And within each of these directory paths are files with an extension of "MP3".

Do you know how to copy ALL of the fiiles with an extension of "MP3" from within all folders
that start with the directory name of "D:\MyDocuments Are Here\My Musci\Something-newest\":
to a new folder titled C:\Something\

For example:
Copy D:\MyDocuments Are Here\My Musci\Something-newest\:The Zombies\Unknown Album\Time of the Season.mp3
Copy D:\MyDocuments Are Here\My Musci\Something-newest\:The Zombies\Unknown Album\She's Not There.mp3


to:
C:\Something\Time of the Season.mp3
C:\Something\She's Not There.mp3




Microsoft DOS

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bill Prew

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Anil

The base folder is the same so use xcopy


xcopy D:\MyDocuments Are Here\My Musci\Something-newest\*.mp3   C:\Something\       /s

Not tested but should work.

A>
Bill Prew

XCOPY will preserve the directory structure, rather than flatten it all down to a single folder, as was requested.

~bp
Anil

Cool.Missed that one.  Then watch out for duplicates if any.

zimmer9 : Did you want to preserve your subflder structure or not ?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
zimmer9

ASKER
I would keep the existing subfolder structure until I can verfiy that the mass copy was performed correctly and then afterwards, I wish to delete the existing subfolder structure.

WHich leads to another question:

How would I delete the subfolders within D:\MyDocuments Are Here\My Musci\Something-newest\:
after I have verified that all files were successfully copied?

Bill Prew

==> How would I delete the subfolders within D:\MyDocuments Are Here\My Musci\Something-newest
==> after I have verified that all files were successfully copied?

I think a typical approach to this would be to run a similar recursive script approach that drills into each of the original folders, this time deleting any MP3 files, and checking each folder containing MP3 files to see if it becomes empty.  If it does, we remove that folder.

Could be done in DOS, but would be a lot smaller script if you were open to a VBS solution?

~bp