Skip to content

Instantly share code, notes, and snippets.

@jcefoli
Created January 28, 2015 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcefoli/376a20a0de274a844660 to your computer and use it in GitHub Desktop.
Save jcefoli/376a20a0de274a844660 to your computer and use it in GitHub Desktop.
This script takes the contents of one directory and copies them into a newly created folder in all existing subdirectories of the destination directory.
@ECHO OFF
REM | This script will take all files and subdirectories in
REM | C:\Source and copy them into a new folder called "Config" in
REM | all subdirectories of C:\Dest. If there are no subdirectories,
REM | nothing will happen
REM |
REM | ie - C:\Source\*.* will be copied to C:\Dest\Folder\Config\*.*
REM | assuming "Folder" was a preexisting subdirectory
REM :: Define Variables Here ::
SET SOURCEDIR=C:\Source
SET DESTINATION=C:\Dest
SET FOLDERSUFFIX=\Config
FOR /D %%a in ("%DESTINATION%\*") do xcopy "%SOURCEDIR%\*.*" "%%a%FOLDERSUFFIX%" /s /i /c /y
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment