I need a batch file to go to a certain folder (say c:\wpdocs) and copy all
files created today to another folder or drive without physically inputting
today's date. It's to be used by a secretary who will click an icon and
doesn't know anything but simple word processing.
I know how to use the xxcopy program but that program expires regularly and
I often forget to reinstall it freeware version.
Would someone be kind enough to give me a line to use xxcopy in a batch file
in this mode? Thanks in advance.
>I need a batch file to go to a certain folder (say c:\wpdocs) and copy all
>files created today to another folder or drive
@echo off
xcopy "c:\wpdocs\*.*" "d:\target folder\" /d
The above isn't quite what you're asking but it will copy all files newer
than the ones that are in the target folder, or don't exist.
From the help: xcopy /?
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
I did find something online that might do the trick. I tried it today and it
worked. I don't understand the 2nd line but that's OK.
@ECHO OFF
FOR /F "tokens=2 delims= " %%V IN ("%DATE%") DO SET TDY=%%V
xcopy /y "C:\My Documents\Word\mike\*.*" "c:\disks\*.*" /d:%TDY%
SET TDY=
@pause
(I added the pause so I can see if it copied and what it copied; and I added
the /y so it will overwrite a file that is already there)
*** See my batch file tutorial at:
http://www.chebucto.ca/~ak621/DOS/BatBasic.html
> I need a batch file to go to a certain folder (say c:\wpdocs) and copy all
> files created today to another folder or drive without physically inputting
> today's date. It's to be used by a secretary who will click an icon and
> doesn't know anything but simple word processing.
> I know how to use the xxcopy program but that program expires regularly and
> I often forget to reinstall it freeware version.
> Would someone be kind enough to give me a line to use xxcopy in a batch file
> in this mode? Thanks in advance.
*** Try:
XXCOPY C:\WPDOCS\*.* C:\BACKUP /DA#0
Without XXCOPY, this might work depending on your DOS version:
XCOPY C:\WPDOCS\*.* C:\BACKUP /D:%DATE%
Richard Bonner
http://www.chebucto.ca/~ak621/DOS/
The /? Help for my XP sp3 XCOPY may apply to you. It says /D:m-d-y ;
that format is only used in a few countries, and not on all systems
there. if %DATE% does not match that, you should not expect it to work.
Note that some software, if given a d-m-y date that is not a valid m-d-y
date, will read it as d-m-y. Therefore, you should test within the
first 12 days of the month, but nor day N of month N, and check that it
is getting the date exactly right.
Read the applicable newsgroup FAQ.
The quoted code will NOT work in on-topic systems, IIRC; if you are
using something other than DOS..Win98/ME, you should be using a.m.b.nt.
Otherwise, see sig below.
--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
The suggestion you made did not work and gave an error about "Sunday."
The following method (found somewhere online) is now working with one
complaint - I would like to avoid backup files or files ending in .wbk if
possible. I'll look up more of the codes for xcopy for that.
@ECHO OFF
FOR /F "tokens=2 delims= " %%V IN ("%DATE%") DO SET TDY=%%V
@xcopy /y "C:\My Documents\Word\docs\*.*" c:\disks\*.* /d:%TDY%
(more similar lines for other folders)
SET TDY=
pause
You add /EXCLUDE:c:\myexclude.txt to the end of the xcopy line.
It copies all files created today except those ending in .wbk
I'm getting there!
*** Whose suggestion, Alynn? Please always show relevant quoted text
when answering newsgroup posts. I will assume you are referring to my
post.
> in my origianl posting I mentioned that I CAN
> do that but xxcopy changes evey few months. I have to download the new one
> and install on multiple computers and confuse my illiterate friends!
*** You need to pay for your copy.
> The suggestion you made did not work and gave an error about "Sunday."
*** Your version may vary from the DOS one. Look at the documentation
and search on "/DA".
> The following method (found somewhere online) is now working with one
> complaint - I would like to avoid backup files or files ending in .wbk if
> possible. I'll look up more of the codes for xcopy for that.
(Snip)
*** XXCOPY can do excludes too. Search its documentation for "/EX".
Richard Bonner
http://www.chebucto.ca/~ak621/DOS/