Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to script a daily copy of files w/dt being name of archive folder

29 May 2014   #1
pglufkin

windows 7 professional
 
 
How to script a daily copy of files w/dt being name of archive folder

Hello,

I need to figure out a Windows 7 script to copy/archive files which are located in a specific folder. It needs to copy daily to an archive folder, with the script creating the archive folder as MM-DD-YY (being that day's date that is being archived) before it archives the files to that folder. The script will run at 9:00 pm every night, the time all work ceases.

If anyone could help me with this script, I would appreciate it.


My System SpecsSystem Spec
.
29 May 2014   #2
Ztruker

Windows 10 Pro X64
 
 

If the archive was going to be D:\MyArchives and the source was C:\Users\youruserid\SomeFolder:

for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a"
set "YYYY=%dt:~0,4%"
set "MM=%dt:~4,2%"
set "DD=%dt:~6,2%"

set datestamp=%MM%-%DD%-%YYYY%
echo datestamp: "%datestamp%"

md D:\MyArchives\%datestamp%
xcopy C:\Users\youruserid\SomeFolder\*.* D:\MyArchives\%datestamp%\ /s/h/r/i/k/e/y

Enter xcopy /? from a Command Prompt to see what the parameters mean.

Above found in a post by foxidrive here: Format date in Windows 7 batch job - Stack Overflow

My System SpecsSystem Spec
29 May 2014   #3
pglufkin

windows 7 professional
 
 

Thank you! So I put this is some .bat file and trigger it through Task Scheduler?

Sorry, I'm not sure exactly how to do this. I think I may know, but just not sure.
My System SpecsSystem Spec
.

30 May 2014   #4
Ztruker

Windows 10 Pro X64
 
 

Yes, put in a .bat file then schedule to run via Task Scheduler.

Test the heck out of it first though.
My System SpecsSystem Spec
Reply

 How to script a daily copy of files w/dt being name of archive folder




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
VB script: Rename all files in a folder to a specified prefix
Hi, I'm trying to find help in entering paths and prefix's in my vb script. I am of course a newbie to visual basic and don't know where to enter the path and wording for prefix. Any help would be most appreciated. Rich
General Discussion
Can't copy Outlook archive file
I'm about to wipe an employees PC and I need to get the archive.pst off the PC first. The Archive file is 6.1GB in size but when I try to copy it to my 32G Flash Drive it says that the "archive.pst is too large for the destination file system." I've done this many times before with larger archive...
Microsoft Office
cant copy files from (x86) folder
Hi , Im using win7 64 ultimate . A program I use installed in tne (x86) folder runs OK and I can save and delete files from within the program but I cannot see these files from Windows Explorer to make a backup . The files display the infamous yellow lock icon (from within the x86 program) and I...
General Discussion
What image backup files to copy to archive device?
I am making regular backups - both the image backup and the file sets using Windows 7 Backup program. No problems with that. But, I periodically would like to copy the image backup to a portable drive. I plan to take this portable drive offsite to a secure location - I call it my archive. ...
Backup and Restore
Cannot move/copy files within folder
In Vista one could move files within a folder to whatever location manually simply by dragging the file to the desired location within the folder. In WIN7 everything seems to be locked and moving a file (for example image file) to the end of a row of other files within a folder won't work. How to...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 05:15.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App