|www.ethanwiner.com - since 1997|
PC Magazine's PCToday and PCCopy
by Ethan Winer
This article first appeared in the December 17, 1991 issue of PC Magazine.
PCToday and PCCopy make backing up your day's work quick and convenient. PCToday scans all the files on your hard disk and makes a list of all the files bearing the date specified. PCCopy then uses the list to copy those files to your designated destination. Click here to download a ZIP file containing the source and compiled program files, and a text version of this web page article.
The full syntax for PCToday is:
PCTODAY [d:] [/d mm-dd-yyyy] [> filename.ext]
Entered without any command line arguments, PCToday displays the drive, directory, filename, and date of all files modified on the current date. Files with read-only, hidden, and system attributes are included. The listing pauses at the end of each screen page (if more than one is needed) and serves as a reminder of which files may need to be backed up.
By adding the optional /d switch, followed by any legal DOS date in standard mm-dd-yyyy format, you can force PCToday to include earlier-dated files. To limit the drives in the search path or to include network and floppy disks drives, just specify them individually on the PCToday command line. (It's important that you remember to include the colon after each drive letter.) For example, to see a list of the files on drives C: and D: (only) with file dates on or after November 25, you would enter the line:
PCTODAY C: D: /D 11-25-1991
Any number of drives can be similarly specified. Spacing is not crucial in any of the command line arguments, and drive letters and the date can be listed in any order or even intermixed.
To send the list to a file (for use by PCCopy) instead of to the display, use the standard DOS redirection symbol (>) followed by any legal filename. You can put such a FILENAME.EXT on another drive, if desired. Thus, given the command:
PCTODAY > D:LOGFILE.B25
PCToday will create LOGFILE.B25 as a filename (which is also known as a response file; see the syntax for PCCopy) in the default directory of drive D. LOGFILE.B25 will contain the names of each file to be backed up in the same order as they would appear on-screen; however, it omits the file dates, the blank lines between directories, and the sign-on message. Restricting the listing to filenames only makes it easier for PCCopy to process the list.
In addition to using a PCToday list file as a source for PCCopy, you can use it with PKWARE's popular PKZIP file compression utility. PKZIP lets you specify that the filenames to be processed are to be found in a response file rather than entered on the DOS command line. Thus, the three-line batch file:
PCTODAY > PCTODAY.RSP
PKZIP FILES.ZIP @PCTODAY.RSP
COPY FILES.ZIP A:
will back up the day's work for your entire system into a compressed file named FILES.ZIP stored on drive A. Note, however, that in this case you must be sure that after compression the .ZIP file will fit on a single floppy disk. If the .ZIP file is too large to fit on a single floppy, you may want to use SLICE, a PC Magazine utility that lets you store one file on multiple floppy disks. [Current versions of PKZIP allow spanning multiple disks.]
The full syntax of the PCCopy utility is:
PCCOPY Source [Destination] [/x filespec]
PCCOPY @Responsefile [Destination]
Used as a standalone utility, PCCopy works in much the same way as the DOS COPY command, except that it restricts its processing specifically to those files that need to be copied. If the destination drive or directory has an identical or newer file of the same name, PCCopy will not overwrite it. That can save you a substantial amount of time when many large files are involved. To copy all unduplicated files from your current directory to the \WORK directory on network drive H:, you would enter:
PCCOPY *.* H:\WORK
As with COPY, you can omit the destination argument if you wish to copy to your current drive and directory. And if a source or destination drive is given but a path is not, the current directory for that drive will be used.
The final--and potentially most powerful--feature of PCCopy when used as a standalone utility is its ability to exclude one or more groups of files. Files to be excluded are identified with the /x command line argument, followed by an identifying filespec, as shown in the following line:
PCCOPY *.* H:\MYDIR /X *.BAK
In this example, the DOS wildcard * is used as part of the exclude specification to prevent the copying of any files that have a .BAK extension.
The ? and * wildcards can be applied to any common parts of a group of filenames, of course--not simply to an extension--and PCCopy allows up to ten different exclude specifications. The placement of the /x specifications is not important; they can even be intermixed with the source and response file (@responsefile) parameters. Note, however, that the /x switch is recognized only when PCCopy is working with a source filespec. As explained below, filenames contained in a reponse file are copied unconditionally; any /x commands are simply ignored.
To use PCCopy with PCToday, you begin by having the latter create a response file (arbitrarily named LOGFILE.B25 previously). Then, instead of supplying PCCopy with a filespec, you tell it to copy the files listed in this response file by preceding it with an at sign (@), as follows:
PCCOPY @LOGFILE.B25 A:
Although you will presumably use PCToday to create the response file most of the time, any group of files can be put into a response file. Remember, however, that when a response file is used with PCCopy, the copying is unconditional: All the files in a response file will be copied, whether or not they are newer than the same-named files on the target drive and directory.
If at any time you forget the syntax for either PCToday or PCCopy, entering the command with the /? switch will display the syntax.
Entire contents of this web site Copyright © 1997- by Ethan Winer. All rights reserved.