Page 1 of 1

Using BAT to copy directories.

Posted: 02 Oct 2021 17:15
by crazygamer24151
I am wanting to have a .bat file make a copy of 3 directories. I want it to make a directory with the day's date in and copy the 3 other directories into it. I want all 3 directories to keep their separate file trees. How do I do this?

Re: Using BAT to copy directories.

Posted: 03 Oct 2021 08:42
by aGerman
Something about like that

Code: Select all

@echo off &setlocal
for /f %%i in ('WMIC OS Get LocalDateTime /value') do for /f %%j in ("%%i") do set "%%j"
robocopy "dir1" "%LocalDateTime:~0,8%\dir1" /e /r:0 /w:0
robocopy "dir2" "%LocalDateTime:~0,8%\dir2" /e /r:0 /w:0
robocopy "dir3" "%LocalDateTime:~0,8%\dir3" /e /r:0 /w:0
Steffen