I am trying to re-copy about 1,500 MP3 files from their source in multiple folders in my music library to a jump drive organized in folders named by artist. Here's an example from the jump drive:

I:\Coldplay\A Message.mp3  
I:\Coldplay\Speed of Sound.mp3  
I:\Coldplay\Square One.mp3  
I:\Coldplay\The Hardest Part.mp3  
I:\Coldplay\White Shadows.mp3  
I:\Coldplay\A Sky Full of Stars.mp3  
I:\Coldplay\Always in My Head.mp3  
I:\Collective Soul\All That I Know.mp3  
I:\Collective Soul\Bearing Witness.mp3  
I:\Collective Soul\Good Morning After All.mp3  
I:\Collective Soul\Hollywood.mp3  
I:\Collective Soul\I Don't Need Anymore Friends.mp3  
I:\Collective Soul\Never Here Alone.mp3  
I:\Collective Soul\New Vibration.mp3  
I:\Collective Soul\Persuasion of You.mp3  
I:\Collective Soul\What I Can Give You.mp3  
I:\Collective Soul\Dig.mp3  
I:\Collective Soul\Fuzzy.mp3  
I:\Collective Soul\Hymn For My Father.mp3  
I:\Collective Soul\Lighten Up.mp3  
I:\Collective Soul\Love.mp3  
I:\Collective Soul\She Does.mp3

The source is organized by artist name/album title, so the songs by Coldplay and Collective Soul have multiple different source folders branched off the Coldplay and Collective Soul folders. And not all songs in each source folder are copied onto the jump drive, only selected ones. Because of this I can't figure out any way to tell the OS where to find the source files to copy, other than manually one-by-one (tedious!). I also have a text file made by doing "DIR /B /S > USB_List.txt". Can anyone think of a way of copying these using a batch or For command. Or is this even possible? Thanks.

  • "copying" .. thats the easiest part. the main problem is "what are you asking?" ... is it that some files are missing after the copy-command? or do you want to select some but not all? how do you want to select them if the latter is the case? – akira Oct 11 '14 at 19:09
  • On a jump drive I have these 1,500 MP3 files. On the source I have recently embedded the cover art jpeg into the MP3. Now I would like to copy all the files I currently have on the old jump drive (sans embedded jpeg) onto a new jump drive in the same order in which they appear on the old jump drive using the newly embedded jpeg MP3 files on the source. – BillDOe Oct 11 '14 at 19:25
  • so, you want all modified .mp3 files (which include the .jpg) but no file with a .jpg ending? – akira Oct 11 '14 at 19:27
  • Might help if you also show the file structure in the source per your example. – Sun Oct 11 '14 at 22:20
  • Akira, the jpegs are embedded within the MP3 files; there is no separate .jpg file. – BillDOe Oct 11 '14 at 23:09

Rather than store in artist\album\title format like current, you want to artist\title format.

Try this in the Command Prompt at the directory you want to:

1) move all files in subfolders under the current folder 2) erase any subfolder names

for /f "tokens=*" %f in ('dir /a:-D /s /b') do move "%f" .

for /f "tokens=*" %f in ('dir /a:D /s /b') do rd "%f"

For example, let's say you have a MP3 here: c:\Cold Play\Ghost Stories\True Love.mp3

  • Go to Command Prompt
  • Navigate to c:\Cold Play (cd "\Cold Play"
  • Running the following commands:

for /f "tokens=*" %f in ('dir /a:-D /s /b') do move "%f" .

for /f "tokens=*" %f in ('dir /a:D /s /b') do rd "%f"

This will move True Love.mp3 to c:\Cold Play and erase the directory called Ghost Stories.

Hope this helps.

  • I don't want to delete the source directories. I just want to copy the MP3 files that are in the jump drive (I:) from the source (D:\Users\username\music\music) to a new jump drive, say, G:. – BillDOe Oct 11 '14 at 20:21
  • You want to only copy file names that exist on the destination but the source has a different folder structure than the destination? – Sun Oct 11 '14 at 22:17
  • sunk818, that is correct. The source has the album title as part of the folder structure, the destination does not. – BillDOe Oct 11 '14 at 23:34

a batch or command line might look at the files on I: and copy them from "D:\Users\username\music\music..." to G:

Make a list of the files you want to copy with DIR /B /S, open it in a good text editor, replace all "I:..." with "D:...", open another copy of the list, replace "I:..." with "G:...", copy-paste the entire content to the first file as another column (using column editing mode) and insert echo f | xcopy in the beginning of each line (in column editing mode as well). Rename to .cmd/.bat, run.

  • It didn't work. The G: drive is still empty, except for the folders I already made there. Here's what the first line of the resulting batch file looks like: echo f | xcopy D:\Coldplay\Mylo Zyloto-Hurts Like Heaven.mp3 G:\Coldplay\Mylo Zyloto-Hurts Like Heaven.mp3. The problem is Mylo Zyloto-Hurts Like Heaven.mp3 isn't in the Coldplay directory but in D:\Users\...\Music\Music\Coldplay\Mylo Xyloto\Mylo Zyloto-Hurts Like Heaven.mp3. – BillDOe Oct 12 '14 at 0:39
  • I'm thinking maybe I can use Excel to match the filename on the jump drive to the source pathname, save the results to a text file, and then use the FOR command structure to find and copy the specific files to my new source. Just gotta figure out the details. – BillDOe Oct 12 '14 at 5:29
  • @BillOer You can use Excel to split the path using Data -> Text to Columns (so you'll get "Coldplay", "Mylo Zyloto", "Hurts Like Heaven.mp3"), and then construct the right path using formulas (i.e. by adding "Mylo Zyloto" as an upper directory). – gino0631 Oct 12 '14 at 14:26
  • What I was planning on doing is extracting the filename and then doing a vlookup go get the associated pathname. I can manually correct the one-offs, then run a FOR command. I'll post back later today. – BillDOe Oct 12 '14 at 16:10
  • Glad you are breaking down your steps. The comparison of what already exists in the destination is the hard part. – Sun Oct 12 '14 at 20:08

Try running this command

ROBOCOPY %%source%% %%destination%% /MIR /ZB /R:3 /W:1

Obviously, replace the placeholder.

  • The source is "D:\Users\username\music\music\..." and the destination either I: or G:. I was hoping a batch or command line might look at the files on I: and copy them from "D:\Users\username\music\music\..." to G:, but I don't mind simply overwriting what's on I:. I tried using xcopy with the /U switch, but that didn't work, as it only finds the files that exist one level up from the one the command is being run from, e.g. if run from D:\Users\username\music\music\, it will find and copy all the files from D:\Users\username\music\music\Artist but not D:\Users...\Artist\AlbumName. – BillDOe Oct 11 '14 at 21:28
  • Robocopy is just a copy, not overwrite. It means Robust File Copy. It is basically a detailed copy command - you can use in a batch file remember! – EdG Oct 12 '14 at 10:09

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.