Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

copy or xcopy files created today only

16,074 views
Skip to first unread message

Alynn Baker

unread,
Oct 10, 2008, 5:02:32 PM10/10/08
to
I am a novice at batch files and can only do simple ones myself for
repetitive tasks. .

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.


Alynn Baker

unread,
Oct 10, 2008, 5:05:54 PM10/10/08
to

foxidrive

unread,
Oct 10, 2008, 5:39:54 PM10/10/08
to
On Fri, 10 Oct 2008 17:02:32 -0400, "Alynn Baker" <asb...@nospam.invalid>
wrote:

>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.

Alynn Baker

unread,
Oct 10, 2008, 10:26:15 PM10/10/08
to
The problem is that it also copies files that don't exist in the destination
so that includes older files. Not what I want.
---------------------------------

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)


Richard Bonner

unread,
Oct 11, 2008, 9:38:55 AM10/11/08
to
Alynn Baker (asb...@nospam.invalid) wrote:
> I am a novice at batch files and can only do simple ones myself for
> repetitive tasks.

*** 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/

Dr J R Stockton

unread,
Oct 11, 2008, 3:25:22 PM10/11/08
to
In alt.msdos.batch message <48f00ee5$0$4905$607e...@cv.net>, Fri, 10
Oct 2008 22:26:15, Alynn Baker <asb...@optonline.net> posted:

>
>@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

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.

Alynn Baker

unread,
Oct 12, 2008, 1:12:27 PM10/12/08
to
About your xxcopy suggestion - 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!
Otherwise it comes up with some error and you have hit Enter multiple times
to make it work again. OK for me, not for the others.

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


Alynn Baker

unread,
Oct 12, 2008, 1:28:13 PM10/12/08
to
I found the way to exclude certain extensions. You create a txt file in the
root called myexclude.txt (for example) that contains the extensions to
omit, 1 per line. I just entered .wbk

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!

Richard Bonner

unread,
Oct 12, 2008, 4:34:23 PM10/12/08
to
Alynn Baker (asb...@optonline.net) wrote:
> About your xxcopy suggestion -

*** 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/

jahid....@gmail.com

unread,
Oct 24, 2013, 9:22:15 AM10/24/13
to
GSCopy Pro v6.0 (RoboCopy Alternative) with Open File Agent
GSCopyPro is a single command-line tool (CLI) that can copy, replicate and move files from one folder to another. This folder can be on the same machine/ server or another server elsewhere. What makes GSCopyPro stand out from other competitors is the fact it works on 32-bit as well as 64-bit systems and has no restrictions. It can easily be scheduled to run as a scheduled task and fully automated. GSCopyPro also comes with an open file agent which can copy files that are locked/ opened by other processes. This feature is supported in all windows versions from widows XP/ 2003 and later.
Go To:>> http://www.gurusquad.com/GSCOPYPRO

ksha...@gmail.com

unread,
Dec 29, 2013, 5:20:15 AM12/29/13
to

dhir...@gmail.com

unread,
Feb 22, 2014, 1:13:19 PM2/22/14
to
Here is the link to make a batch file to copy files over the network and automatically zipping with current date : http://answers-free.blogspot.in/2014/02/making-batch-file-to-copy-files-over.html
Message has been deleted
0 new messages