home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.binaries.ibm.pc.archives
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!utcsri!torn!watserv1!mc1adm.UWaterloo.ca!dp35
- From: dp35@mc1adm.UWaterloo.ca (Greg Moore)
- Subject: Re: Move command for DOS needed
- Message-ID: <Bs7xKB.7Gq@watserv1.uwaterloo.ca>
- Sender: news@watserv1.uwaterloo.ca
- Organization: University of Waterloo
- References: <1992Jul30.025640.139506@zeus.calpoly.edu> <19438@plains.NoDak.edu>
- Date: Thu, 30 Jul 1992 20:14:34 GMT
- Lines: 65
-
- In article <19438@plains.NoDak.edu> jorgense@plains.NoDak.edu (Lee A. Jorgensen) writes:
- >In article <1992Jul30.025640.139506@zeus.calpoly.edu> wliu@zeus.calpoly.edu (Wen Hong Liu) writes:
- >)Does anybody know if there is a utility that will enable me to move
- >)files from one directory to another at the DOS prompt.
- >
- >You can also use DOS. If you have Doskey.Com, then you can make a Bat file
- >that holds all of your special commands like move.
- >
- >The syntax would be:
- >doskey move=copy $1 $2 $t del $1
- >
- >The call would be:
- >move *.bak c:\temp
- >
- >to move all bak file to the temp directory.
- >
- You could also be more carefull by using "if exist" in a
- batch file.
-
- MOVE.BAT
-
- if (%1)==() then goto NoParms
- if (%2)==() then goto NoTwo
- rem I'm not to sure about the "for" loop but I think it might
- rem go something like this
-
- Move:
- for %A in (%1) goto CopyFile
- goto end
-
- CopyFile:
- if exist %2\%A goto ItExists
- ReturntoCopy:
- copy %A %2
- del %A
- goto Move
-
- ItExists:
- echo.
- echo %A already exists. Hit Ctrl-C to avoid overwriting this file
- echo.
- pause
- goto ReturntoCopy
-
- NoParms:
- echo.
- echo You must pass two parameters. The first is for the
- echo files you wish to move, followed by the directory
- echo you wish to move them to.
- goto Example
-
- NoTwo:
- echo.
- echo You must specify the directory to which you want the
- echo files passed.
-
- Example:
- echo.
- echo eg. move *.bak c:\temp
- echo.
-
- end:
-
-
- *** I did not test this and make no guarantees that it will work.
-