1

I have a music player that needs all the files to be in the root of the internal storage. My windows "Music" library I've been using through WinAMP has a folder layout of 28 top folder like so:

#'s SYMBOLS A B ...(etc) Y Z

Each folder has countless sub folders organized like this:

ARTIST\ALBUM\<files here>

How do I copy just the base files, ignoring all the folder structure, from the Music library to the external music player's SD card?

  • Been running it one Top folder at a time (A, then B, then C, etc.) and it's been working great. Just forgot I have a few files that are the same name but different extensions, but it's not a big enough issue that I can't clean up by hand after each run. – WorseDoughnut Apr 11 '17 at 19:00
1

You can do this using a FOR /F loop using the DIR command and then iterating accordingly to the XCOPY command. Just be sure to use the command switches accordingly as in the example below.

Note: I'm assuming by "base files" or "bottom files" you are saying you want to copy the <files here> as in your example regardless of what folders those are in so this is based on that.


Batch Script

Set the SrcDir, DestDir, and/or the music file extension name (.mp3) accordingly below.

@ECHO ON

SET SrcDir=C:\Users\User\Music\TopLevel
SET DestDir=F:\ExternalMPPlayer

FOR /F "TOKENS=*" %%F IN ('DIR /S /B "%SrcDir%\*.mp3"') DO XCOPY /F /Y "%%~F" "%DestDir%\"

EXIT 

Further Resources

  • @WorseDoughnut Let me know if you have any trouble with this or questions, etc. I've tested and confirmed it works just as I explain and as per my understand of your question. I assume you'll plug in your variable values accordingly and also run elevated from run as administrator command prompt or right click to execute. – Pimp Juice IT Apr 10 '17 at 5:10
  • Awesome, I'll try this out when I get home from work. WIsh I had read this before I left, this is gonna be moving ~90GB of files... – WorseDoughnut Apr 10 '17 at 15:17
  • Also, would "%SrcDir%\*.*" work for moving various types of extension names at the same time? I've got a jumble of mp3s and flacs – WorseDoughnut Apr 10 '17 at 15:19
  • @WorseDoughnut I wanted to point out that if there are duplicate file names because those are in different folders now, then the last file copied by the XCOPY command will be the one that is on the external media. You might confirm a file count on source and destination that the number or files is the same. I wouldn't base it off size in GB only as that can fluctuate from system to system based on different disk configurations. Based on this task, if FileA.mp3 is in /FolderA and a different file with the same name FileA.mp3 is in /FolderB, then you will NOT get both in the same dest. – Pimp Juice IT Apr 10 '17 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.