Discussion Locked

Name folder after current date?

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

I've got a Windows 2000 Server with a fax modem on which I recieve alot of faxes. Right now, all faxes are just saved to a folder called "fax". I would like to automatically create a new sub-folder named after the current system date every time the first fax of the day comes in. All subsequent faxes on that day should also go into the current day's folder.

I seem to remember being able to use variables such as %system_date% or %date% in login scripts, but I've yet to discover the correct wayto solve my current problem.

Thanks

6 replies

by pacalealaathotmail.c

this batch file will create %date%
(test it from a:)

echo @prompt set date_=$d> tmp$$$.bat
%comspec% /c tmp$$$> tmp2$$$.bat
call tmp2$$$
echo %date_%
del tmp$$$.bat
del tmp2$$$.bat

by ja_seaton

I guess I should clarify a bit. If i type... echo %date% ...at the command line, it shows the current date. I think environment variables are native to Windows 2000. But when I tell the fax client to save new faxes to D:\fax\%date%, it saves them tothe folder D:\fax\%date%, instead of D:\fax\Wed 07/17/2002.

by mckaytech

I don't have the fax client available to test, but enclosing the %date% in double-quotes might work.

Another alternative would be to run a batch file every midnight through Task Scheduler that creates a new folder, copies that day's faxes to thatfolder and then deletes them from the receiving folder. Then your fax client would always point to the same folder.

This might look like:

d:
cd \fax
md \"%date%"
copy *.* d:\fax\"%date%"
del *.*

If this works in principle, you might want to add a little error checking to make sure the files copied before they are deleted or at least make sure this batch file only runs after the nightly backup has run so you can recover the day's faxes if something goes awry.

regards!

paul

This discussion is closed to new replies.