Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BACKUP make folders with the date as name

Status
Not open for further replies.

Aswin01

IS-IT--Management
Jun 17, 2003
29
BE
@echo OFF
set map="C:\Documents and Settings\Coolsaet Aswin\Bureaublad"
echo %date%
echo even geduld aub...
md "c:\%date%"
xcopy %map% "c:\%date%" /e/y >nul
pause

This is a TEST bat file.
%date% is an variable of windows -> type in command "echo %date%" --> response: "do 19/06/2003"

Now he make a map "do 19" and as submap "06" and subsublap "2003"
file are copied in the subsub 2003 map.
Is there an other way the make a folder with the name ofthe date.
like 2003-06-19 do or 2003 06 19 do "-" are allowed for folder names
 
Hello Aswin01,

If you use the .bat the way you sketched, then you have to have a firmer control on the cmdprompt environment before executing those lines. This is the way how you can do it with surgical precision.

[1] Make out a .reg file.

'-----below this line-----
REGEDIT4

[HKEY_CURRENT_USER\Control Panel\International]
"sDate"="-"

'-----above this line-----

[2] Import the .reg file with regedit.exe. (Common caution applies.)

[3] Other remarks
[3.1] It is set for current user. You can do it for .default too the same way.
[3.2] It is not that I do not take care of other changes needed. It is because I let the reg provider to take care of the rest itself.
[3.3] I believe it is a popular way to create (backup) file with the date/time stamp in the filename. Then, later, one might come to regret doing that. In any case, at some point in time, you need better control than you sketch in the .bat in the production environment.

regards - tsuji
 
ok thx,
found it, it was
sShortDate "yyyy-MM-dd" before d/MM/yyyy

i run my pgrm and it ok now...
map name "2003-06-20"
thx !!!
it is a bat file that run every friday... on the server.
and the files came from the administration.

@echo OFF
set map="\\pentiumiv\adminstration\"
echo %date%
echo even geduld aub...
md "c:\backup\%date%"
xcopy %map% "c:\backup\%date%" /e/y >nul
pause

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top