computing
  • 1

Solved Batch- Cut And Paste FOLDERS Listed In Txt File

  • 1

Hi all,
I have a notepad file with a list of folder names. what i need is a batch file that will read from the text file and cut the folders (with subfolders and files) and paste it to a different directory.

The txt file will have the names of the folders listed.

for example

Folders are located here: C:\source
Folders should be copied here: C:\destination
Which folders exactly needs to be copied stands in the txt.

Thanks,

Share

1 Answer

  1. here’s one way, based on the first script:
    @echo off
    for /f %%a in (copyjob.txt) do (
    xcopy /e /i c:\source”%%a” c:\destination”%%a”
    :: i don’t think the following is required, but ya never know.
    :: del /s c\source”%%a”\*.*
    rd /s /q c:\source”%%a”
    )
    ::==== end

    and here’s another approach, based on Tony’s and Mike’s excellent suggestions (which i did not think of):
    @for /f %%a in (copyjob.txt) do move c:\source”%%a” c:\destination”%%a”
    :: end

    • 0