View Single Post
  #2   Report Post  
James Waldby
 
Posts: n/a
Default

Chris wrote:
"Karl Townsend" ... wrote...

....
I need to make a batch file

[snip]
something like this

CD\SALES
MD today's date
CD today's date
COPY C:\SALES\*.DBF
COPY C:\SALES\*.CDX

I know this is totally way off topic. Almost as bad as discussing
politics. Metal content: The SO put her foot down, I can't start welding
on the next project until this is fixed.

....

Works for me

Not sure of which version of Microsoft you are using.
Might need to specify as the commands vary somewhat.

md %date:~-4,4%\%date:~-10,2%\%date:~-7,2%

This is a neat trick off the top of my head. It creates a tree of
directories (ie. year, than the month then the day)

....
I found this years ago and it works great.

....

Under W2000, date outputs as (eg) "Sat 09/03/2005", so perhaps
that's different from yours. A command file I tested:
set v=%date:~10,4%.%date:~4,2%.%date:~7,2%
echo %v%
mkdir "%v%"
cd "%v%"
copy ..\*.bat .
dir/w
cd ..
produces directory names like "2005.09.03". That is,
a flat set of directories rather than your tree form,
2005\09\03

Karl - http://www.computerhope.com/sethlp.htm has
some examples near the middle of the :~ op.
-jiw