Computing Staff
  • 1

ROBOCOPY – Copy Folders Content To A Single Folder.

  • 1

Here is some code I made 🙂

@echo off
set source=”R:\Contracts\”
set destination=”R:\Contracts\Sites\”
ROBOCOPY %source% %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /R:0 /S
for /r %source in (*) do @copy “%destination” .

R:\Contracts\ is full of folders which have files in them.

I want to copy all to R:\Contracts\Sites\ and flatten the folder structure.

Everything copies well but also the folder structure.

Thank you


1 Answer

  1. This works……
    @echo on
    set source=”C:\folders”
    set destination=”C:\folder2″

    for /r %source% %%F in (.) do if “%%~fF” neq %destination% ROBOCOPY %%F %destination% *.srt *.pdf *.mp4 *.jpg *.txt /COPYALL /R:0

    • 0