Batch Code creating

February 21, 2009 at 17:03:42
Specs: Windows XP
i need to create a batch code .bat that will allow me to copy 'folderA to Folder B on a pc on my network once a week, and renaming the new version of the folder to the date it copied. ie not replacing the old notupdated folder

See More: Batch Code creating

Report •


#1
February 21, 2009 at 18:37:50
Here's what I use on my XP Home PC and it works fine. This creates a folder mmddyr on my d:drive and I use xcopy. The quotes in the command allow the use of long file names

set string=%date%
echo %string%
SET STRING=%STRING:~4%
SET STRING=%STRING:/=%
echo %string%
md d:\%string%
cd d:\%string%
xcopy "c:\scansoft documents\*.*" d: /s /e /r /y
pause ****SUCCESSFUL OPERATION*****


Report •

#2
February 21, 2009 at 21:24:46
k sorry, im a little bad with computers.

i want to copy folders and subfolders

C:\Documents and Settings\James\My Documents\Business

to

C:\Documents and Settings\James\My Documents\Unzipped

and then i want to schedule the copies once a week, and have them make new folders with each weeks date on it.


Report •

#3
February 22, 2009 at 20:59:53
The below will create a subfolder with current date under the Unzipped folder

set string=%date%
echo %string%
SET STRING=%STRING:~4%
SET STRING=%STRING:/=%
echo %string%
xcopy "C:\Documents and Settings\James\My Documents\Business\*.*" "C:\Documents and Settings\James\My Documents\Unzipped\%string%\" /s /e /r /y
For instance if I ran the program now, I would have all the data in the "Business" folder now copied to the c:\documents and settings\James\My Documents\Unzipped\022209

How you schedule it is up to you. I just used notepad to type the data and saved it as a file called backup.bat and ran it from a shortcut on my desktop

Good luck


Report •

Related Solutions

#4
February 23, 2009 at 08:55:58
hi sorry,

i need to copy a folder the D\documents to C:Documents2\

daily, and Updating the folder with the date new date.


Report •


Ask Question