home *** CD-ROM | disk | FTP | other *** search
- echo off
- echo ┌──────────────────────────────────────────────────────────────────┐
- echo │ Same device COPY by Timo Salmi, ts@chyde.uwasa.fi, 18-Aug-91 │
- echo ├──────────────────────────────────────────────────────────────────┤
- echo │ NO paths NO device names allowed in file names │
- echo └──────────────────────────────────────────────────────────────────┘
- echo.
- if "%1"=="" goto _err1
-
- if not exist %1 goto _err2
- md r:\tmp$$$
- if not exist r:\tmp$$$\nul goto _err3
- if exist r:\tmp$$$\*.* goto _err4
- copy/v %1 r:\tmp$$$\%1
- echo %1 copied to r:\tmp$$$\%1
- echo Change the target disk to the drive
- pause
- if exist %1 goto old
- copy/v r:\tmp$$$\%1 %1
- echo r:\tmp$$$\%1 copied to %1
- goto _dele
-
- :old
- echo %1 already exists!
- echo Apply break to exit without copying
- echo (If you break, you must then manually remove the TMP$$$ directory and its files)
- echo Strike a key when ready to copy . . .
- pause > nul
- copy/v r:\tmp$$$\%1 %1
- echo r:\tmp$$$\%1 copied to %1
- goto _dele
-
- :_err1
- echo Usage SCOPY FileNameWithoutPath
- echo.
- echo This batch is intended for copying one file at a time when only a single
- echo device, and a ramdisk D: are available. Wildcards are allowed, but not
- echo recommended. You must NOT use paths in file names! Be careful if you copy
- echo a file located in a subdirectory. The destination directory depends on the
- echo directory tree (if any) of the destination disk. (It will be the root or
- echo a directory with an equivalent name.)
- goto _out
-
- :_err2
- echo File %1 not found
- goto _out
-
- :_err3
- echo Directory r:\tmp$$$ could not be created
- goto _out
-
- :_err4
- echo Directory r:\tmp$$$ is not empty
- goto _out
-
- :_dele
- if not "%1" == "*.*" goto _dele2
- if not exist r:\tmp$$$\%1 goto _rmdir
- echo y|del r:\tmp$$$\%1 > nul
- goto _rmdir
-
- :_dele2
- if exist r:\tmp$$$\%1 del r:\tmp$$$\%1
-
- :_rmdir
- rd r:\tmp$$$
-
- :_out
- echo on
-