Dmove/Dcopy Version 4.0 DannySoft Inc. Daniel B. Doman 166 East 96th Street New York, N.Y. 10128 Voice: 212-289-1024 Data: 212-427-1805 (c) Copyright Daniel B. Doman 1983-89. All rights reserved If you are using Dmove and find it of value, your gift in any amount ($20 suggested) will be greatly appreciated. Please make checks payable in U.S. dollars to DannySoft Inc. For use by corporations and other institutions, please contact me for a licensing arrangement. Customizing, licensing of the source, and other special licensing are available upon request. Purchase orders and invoicing are acceptable. You may not charge for the use of Dmove or Dcopy without the written permission of the author. Feel free to freely distribute this program provided that no fee is charged for such copying and distribution, and that it is distributed ONLY in its original, unmodified state, including this documentation. Dmove is a file mover/copier. It can MOVE files and directory trees, or just copy them. Various command line switches allow you to specify which files will be copied, and how to handle duplicates and errors. Dmove was originally written to be a file mover only, but many users were so frustrated with the performance and bugs in DOS XCOPY that the '/C' copy switch was added. As long as I was at it, I added the /R replace switch as well. The first two versions of Dmove were called Cmove, but the name was changed to match the naming convention used with other programs from DannySoft. Dmove will work effectively on Local and Network drives. Unlike many versions of XCOPY and REPLACE, Dmove is not DOS version sensitive. It will work with all versions of DOS from 2.x throgh 4.x.. An alternative version of Dmove is enclosed called Dcopy. This is really the same program but defaulted to COPY files instead of MOVE'ing them. "Dmove /C" and "Dcopy /M" would achieve the same effect. Below are the various command line switches you can use with Dmove, and a brief description of what they do. /E Try To Move/Copy Additional Files After An Error. By default Dmove will stop moving/copying files after the first error. This switch will tell Dmove to try to continue with other files. This switch DOES NOT cause Dmove to IGNORE errors. If you are trying to move/copy as many files as possible to a target drive, you can might want to use this switch. -H Also copy Hidden files. -I Move/Copy even if source target are identical. By default, Dmove will skip any file that has an identical twin for a target. The /Ignore switch tells Dmove to Move/Copy even though a file identical to the source file already exists in the target directory. Dmove considers any file with the same name, size, and exact date and time to be the same. -ND Fail If Destination Directory Does Not Exist. By default, Dmove will create the target directory path if it does not already exist. This switch will force Dmove to fail if the target path does not already exist. -NA Do not copy source file attributes. By default Dmove will replicate the source attributes on the target. This means that the target file will be marked read only if the source file was. If The /H(idden) switch is also used, hidden source files will become then visible target files. -S Search And Move/Copy From Subdirectories. This switch tells Dmove to move/copy entire directory trees. It will replicate the source path in the target directory. It will not create empty subdirectories. -SE Move/Copy all subdirectories trees INCLUDING empty directories. -C (Dmove)Copy Only. The default mode for Dmove is MOVE e.g.. files are MOVED from one location to another. This switch tells Dmove to COPY files. -M (Dcopy)Move files. The default mode for Dcopy is to COPY. This switch tells Dcopy to move files - just like the default mode for Dmove. -R Replace Only - Move/Copy only if target already exists. The combination of the /C and /R switches can make Dmove a handy update utility. -D Move/Copy Only if source file is newer than target (if any). This switch tells Dmove to perform a date comparison whenever a file with the same name exists in the target path. If there is no file with the same name in the target path, Dmove will Move/Copy anyway. -U Update - Replace with newer files. This switch is really the same as /R/D. -T Retain the target path for subsequent commands. This command lets you use a bit of shorthand with Dmove. By default Dmove tries to think of each command as a "From-To" pair. The /T(arget) switch tells Dmove to keep using the last target specified. This can be handy when you are moving/copying from several different directories to a single target, or when you are moving/copying files with several specific extensions and you are running out of DOS command line room. If the source arguments do not contain wildcards, you must separate each command with a semi-colon so that Dmove can distinguish one source from another. -T={Path} This variation on the "/T" switch would allow you to specify a constant target directory before subsequent source arguments. The constant target directory will still be overridden by later target arguments. This command may be especially useful if you pass Dmove a list of filename arguments to move in a @filename argument. @File Arguments can also be passed in a file. There is no limit to the number of filename arguments that you can pass on the command line. Filename arguments can themselves include other filename arguments. The maximum depth of inclusion is 5. If you need more than that you are probably on drugs. Warning! Be sure that you do not accidentally `move' your include file while the Dmove is still reading from it! -DOS Parse an @Include file generated from a DOS DIR command. This command MUST be used in conjunction with the /T= switch. When using this switch, ONLY @Include files generated with a DOS DIR command. This command can be very handy when wildcard arguments cannot suffice. For example, you might want to move/copy ALL but certain .EXE files from the current directory. You could generate a file list with DOS DIR command, and then edit out the files you do not want to move/copy before handy the file list to Dmove/Dcopy with an @Include command. Any line which begins with a space is ignored. How Dmove Works Dmove moves files as efficiently as it can. If the source and target paths APPEAR to be on the same drive, Dmove will try to rename the source name to the target name. If that effort fails, or the source and target path do not appear to be on the same drive, Dmove will create a copy of the source file in the target path, and unless the /C(opy) switch has been specified, delete the source file. Dmove compares the source and target arguments for a drive letter, so you can force a physical copy instead of a rename if you specify a drive letter in one path argument but not the other. Dmove will delete the source directories if it is not COPYing and if the source directories are emptied. File attributes, including the read/only and system attributes will be replicated in the target file, but as a safety measure, Dmove will not operate on hidden files unless the /H switch is used. A path or drive letter given as the source argument will be interpreted as all files (*.*). Dmove parses all command line switches first, so they can be given in any order, and anywhere on the command line. When you specify a drive letter only for the target this means the `current directory' on that drive. Some Novell shells have problems with certain DOS functions when used this way, so Dmove appends a ".\" to the drive letter. Thus "M:DooDah.Com" becomes "M:.\DooDah.Com". Command Line Parsing Dmove generally expects arguments in Source/Target format. A semi colon following an argument can be used to mark the end of a command. If no target argument is found, the default directory is used unless the /T{=} switch was used. If a second argument contains a wildcard, Dmove understands that this is the source argument of the next command, and will assume that no target was specified for the previous command. Thus "Dmove /c d:*.exe f:*.exe g:*.exe" would copy all .EXE files from the current directory on drive D, F, & G to the current directory of this drive. If you pass in filename arguments, Dmove will parse them as part of the command line stream. Carriage returns in a filename argument are treated like semi-colons e.g.. end_of_a_command. If you are using the /DOS switch, the only @Files that you can use are Dos Directory files. Examples Dmove \foo\*.* YaYa Dmove \foo YaYa - Move all files from subdirectory foo to subdirectory YaYa Dmove \foo .. - Move all files from subdirectory \Foo to the PARENT of the current directory Dmove . .. - Move all files from the current directory to the Parent of the current directory Dmove \foo YaYa /C - COPY all files from subdirectory foo to subdirectory YaYa Dmove \foo YaYa /C/S - COPY all files and subdirectories from subdirectory foo to subdirectory YaYa Dmove a: - Move all files from Drive A: to the current drive and directory Dmove \newstuff a:\ /U/C - Update A: with new files from directory \Newstuff. Copy Only Dmove C:\newstuff \newstuff\ya - Copy files from directory Newstuff to a subdirectory of Newstuff "YA", force a physical copy instead of a rename Dmove \foo; \Glue; \YoMaMa; - Move all files from directories \Foo, \Glue, and YoMaMa to the current directory Dmove a:\ /s/c Dmove a: /s/c - COPY all files and directories to the current drive and directory Dmove d:\*.* P:\Backup /S/C - Copy Everything On Drive D: to P:\Backup Dmove \zot Glot; \Pookie; \Droopie; /t - Move all files from subdirectories \Zot \Pookie and \Droopie to the subdirectory Glot. Note use of semi-colon Dmove \Here\*.dat \Foo\Yahoo /ND - Move Fails if "\Foo\Yahoo" Does Not Exist Dmove \*.exe \*.com \*.bat /C - Copy all .EXE, .COM and .BAT files from the root directory to the current directory Dmove @ARGS - Take all commands from the filename ARGS Dmove /C/T=D:\BACKUP @FILES.LST - Copy all files in FILES.LST to D:\BACKUP Dmove YaYa.Doc \NewDir @FILE.LST /T - Copy YaYa.Doc and the Files In FILES.LST To \NewDir Dmove /T=F:\Flatulo /DOSFILE @DOSDIR.LST /C - Copy the files listed in DOSDIR.LST to directory F:\Flatulo. The DOSDIR.LST file was generated with a DOS command such as "DIR *.DOC >DOSDIR.LST" Changes from Version 3.0: - @Filename argument support and /T={path} switch added. The @Filename allows commands and/or lists of files to be passed in a filename argument, rather than just on the command line. - Added logic to treat wildcards in a second argument as part of the next source/target pair e.g.. dmove \*.xxx \*.zzz - Added test against DTA blocks in order to trap attempts to copy/move a file to itself - Additional switches added to move/copy empty directory trees, and hidden files. - Added an alternate form of Dmove called Dcopy which defaults to "Moving" files instead of copying them. Fixes: - Certain types of Disk I/O errors were causing Dmove to abort without deleting its work files.