Using BAT to copy directories.
Moderator: DosItHelp
-
- Posts: 1
- Joined: 02 Oct 2021 17:04
Using BAT to copy directories.
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.
Something about like that
Steffen
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