question

techresearch7777777-7743 avatar image
0 Votes"
techresearch7777777-7743 asked SunnyQi-MSFT answered

Copy folder-files from one location to another including Date-Time stamp?

Hello, can someone provide me a .bat batch script that I can run that will copy all the contents (files and subfolders) from one local folder to another different location and includes Date-Time stamp to the Hour & Minutes?

i.e. copy "C:\Backups" to different location "\\SharedDifferentDisk\Backups_20210330_1500"

And then when I run it again like 15 minutes later the next time it will create another new destination folder like "\\SharedDifferentDisk\Backups_20210330_1515"

Any type of free built in copy like xcopy or robocopy or something else is good.

Thanks in advance.

windows-server
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DSPatrick avatar image
0 Votes"
DSPatrick answered

You could use PowerShell to copy the items.
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/copy-item?view=powershell-7.1

--please don't forget to Accept as answer if the reply is helpful--





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SunnyQi-MSFT avatar image
0 Votes"
SunnyQi-MSFT answered

Hi,

Thanks for posting in Q&A platform.

Here are some similar thread talking about copying folder to new location with timestamp, you could have a look:

How to copy folder to new location and give it a timestamp

Copy the file from one folder to the other and add a time stamp as a suffix when copying batch script

How to copy an entire folder with current date/time in destination folder name?
Please Note: Since the websites are not hosted by Microsoft, the links may change without notice. Microsoft does not guarantee the accuracy of this information.

Best Regards,
Sunny


If the Answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.