0

How can I copy certain specific folders and its contents from one drive to another?

The music files on my mp3 player got corrupted, so I used the dir command to generate a text file of the folder names I want to copy. Then I formatted the SD card in mp3 player and now I want to copy over a fresh copy from my computer.

The mp3 files are organized into folders per album. I only want the particular folders (and contents) that were originally on the mp3 player. I don't want to copy my entire music collection.

First I opened command prompt and navigated to the music folder in my C:\ The mp3 player is E:\.

Then I tried:

for %I in (Folder4 Folder17 Folder23) do copy %I "E:\music"

And I tried:

for %I in ("Folder4" "Folder17" "Ffolder23") do xcopy /s /i %I "E:\music"

But I just get the contents of the files and not the folders they are in.

What I want is to copy only Folder4 and Folder17 and its contents from C:\ to E:\ and have the folders in E:\ be named what they were named in C:\

Io-oI
  • 9,237

1 Answers1

1

What you can try would be something like this:

for %i in ("C:\The\Full\Path\To\Music\Folder4","C:\The\Full\Path\To\Music\Folder17","C:\The\Full\Path\To\Music\Folder23")do RoboCopy.exe "%~i\." "E:\music\." /MOV /FP /NP /IS /Z /E 

@echo off

for %%i in =;( "C:\The\Full\Path\To\Music\Folder4" "C:\The\Full\Path\To\Music\Folder17" "C:\The\Full\Path\To\Music\Folder23" );= do RoboCopy.exe "%%~i." "E:\music." /MOV /FP /NP /IS /Z /E


Obs.:
enter image description here

You can make an attempt with RoboCopy, where execution shows you the files that will be copied/moved, using with the switch /L or without /L

   Test: RoboCopy.exe "C:\Music\." "E:\Music\." *.gz /MOV /FP /NP /IS /Z /E /L

Execution: RoboCopy.exe "C:\Music\." "E:\Music\." *.gz /MOV /FP /NP /IS /Z /E /L



Some further reading:

Some answers that might help

Io-oI
  • 9,237