Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file W2K3: Create DIR w/today's date, etc.  (Read 3456 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
Batch file W2K3: Create DIR w/today's date, etc.
« on: February 08, 2006, 06:48:06 AM »
I did a quick search and could not find what I need.  I have tried this on my own and came very close... but no cigar!

Here is my scenario:  I have computer out in the shop that contains all the CNC programs we use daily in our manufacturing process.  This computer up-loads and downloads these CNC files from each of several machine tools via hardwire and a port switcher.  Several semi-qualified people send/receive these files daily, and they manage to "hose up" files constantly.  I do a normal back up every night, but some times a file is corrupted and we don't know it until 6 months later.  My back-ups normally only go back a maximum of 8 weeks.

I now have plenty of network storage available and would like to COPY (not BACKUP) the directory (about 35 MEG) once a week to a network folder.  What I attempted to do was write a batch file to be run on my utility server as a scheduled task.  What I want it to do is; create a DIR named as "today's date", and copy the target directory in its entirety, then close.

My last attempt would create the new Dir and name it properly, but then it copies the target directory to the root instead of the newly named DIR.  I'm sure it is just an issue with me being "SYNTAX" challenged.  The only way I ever get syntax right is copy/paste!!!

My utility server is running Windows Server 2003 .NET and the target machine is a Windows Advanced Server 2000.

Below is what I have that DOES work.  This will create a new DIR and name it properly.  What I can't seem to do is then make this newly created DIR the target to copy the files to.

I would appreciate any assistance with the second half of this batch file.

@echo off
for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set var= %%A%%B%%C
md %var%