Discussion Locked

Utility which can create folder with cur

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Is there any small utility (preferably free) which can create folder with the current date. & which can be used with scripts.

Actually I want to use that with one of my batch file I use to backup files. Any utility or suggestion is welcome.

5 replies

by postmaster

You can use XCOPY /A to copy files. The /A tells it to copy only files with the archive bit set. Basically if you copy a file with XCOPY /A it will turn the archive bit off, then you make a change to the file and the archive bit is turned back on. Next time you run XCOPY it will ignore any file that has not been changed.

As far as seeing the date the folder was created, Windows will tell you that. Open Windows Explorer, on the right hand windows you'll see "name" "size" etc.. Right click "name" and you'll get a list of coloums to view.

by shanghai sam

Im looking for a tool which create folder name with the current date and /or time. I know the use of Xcopy.

by joseph moore

Are you asking how to make a folder that is named the current day's date?

Try this:

for /f "tokens=1-4 delims=/ " %%i in ('date /t') do mkdir %%j-%%k-%%l

That will make a directory called 07-17-2002 (if you run it today).
Now, it is set up to be used in a BAT file (the %% is used when you use the FOR command in a BAT file). So, put this in your BAT file and set up the full path you want these folders in. If you want them all under C:\TEMP, then you would have in the BAT file:

for /f "tokens=1-4 delims=/ " %%i in ('date /t') do mkdir C:\TEMP\%%j-%%k-%%l

hope this helps

by faisalmasood

Joseph you r gr8. Now Its working perfectly. I've made a batch file using Winzip command line to backup our production web servers daily. & I've scheduled script to do backup operation daily at night.

Using SQL2000 autobackup & this batch file I'll also backup SQL DBs & then I'll sit back & do rest of my work.
The script is more & less like this:

@ echo off
cls
Echo ###############################################################
Echo ~~~~ Backup Script ~~~~
Echo -----------------------------------------------
Echo This script make zip files of locally hosted Applications. Features are:
Echo 1- Maximum Compression zips
Echo 2- Password protect the zips
Echo 3- Include Hidden and System Files
Echo 4- Create a Backup Folder with current date & move zips in that folder.
@ Echo .
Echo ##############################################################
for /f "tokens=1-4 delims=/ " %%i in ('date /t') do mkdir H:\%%j-%%k-%%l

for /f "tokens=1-4 delims=/ " %%i in ('date /t') do cd H:\%%j-%%k-%%l
net use w: /delete
net use x: /delete
net use y: /delete

net use w: \\server1\e$
net use x: \\server1\c$\inetpub\wwwroot
net use y: \\server2\c$\inetpub\wwwroot
Rem Application Server Backup
wzzip.exe -rp -whs -ex -s420 site1.zip x:\site1\
wzzip.exe -rp -whs -ex -s420 site2.zip x:\site2\
wzzip.exe -rp -whs -ex -s420 Bl.zip w:\Bl\
wzzip.exe -p -whs -ex -s420 UploadReport.zip w:\Uploads\*.doc
Rem server2 Backup
wzzip.exe -rp -whs -ex -s420 site3.zip \\server2\c$\Inetpub\wwwroot\site3\

net use w: /delete
net use x: /delete
net use y: /delete
Rem whs includes system and hidden files.
Rem 420 is Password
Rem ex for Max Compression
cls
Echo ################################################################################
Echo The backups has been made.
Echo ###############################################################
exit

This discussion is closed to new replies.