home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / binaries / ibm / pc / archives / 3634 < prev    next >
Encoding:
Text File  |  1992-07-30  |  1.9 KB  |  77 lines

  1. Newsgroups: comp.binaries.ibm.pc.archives
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!utcsri!torn!watserv1!mc1adm.UWaterloo.ca!dp35
  3. From: dp35@mc1adm.UWaterloo.ca (Greg Moore)
  4. Subject: Re: Move command for DOS needed
  5. Message-ID: <Bs7xKB.7Gq@watserv1.uwaterloo.ca>
  6. Sender: news@watserv1.uwaterloo.ca
  7. Organization: University of Waterloo
  8. References: <1992Jul30.025640.139506@zeus.calpoly.edu> <19438@plains.NoDak.edu>
  9. Date: Thu, 30 Jul 1992 20:14:34 GMT
  10. Lines: 65
  11.  
  12. In article <19438@plains.NoDak.edu> jorgense@plains.NoDak.edu (Lee A. Jorgensen) writes:
  13. >In article <1992Jul30.025640.139506@zeus.calpoly.edu> wliu@zeus.calpoly.edu (Wen Hong Liu) writes:
  14. >)Does anybody know if there is a utility that will enable me to move
  15. >)files from one directory to another at the DOS prompt.
  16. >
  17. >You can also use DOS.  If you have Doskey.Com, then you can make a Bat file
  18. >that holds all of your special commands like move.
  19. >
  20. >The syntax would be:
  21. >doskey move=copy $1 $2 $t del $1
  22. >
  23. >The call would be:
  24. >move *.bak c:\temp
  25. >
  26. >to move all bak file to the temp directory.
  27. >
  28. You could also be more carefull by using "if exist" in a
  29. batch file.
  30.  
  31. MOVE.BAT
  32.  
  33. if (%1)==() then goto NoParms
  34. if (%2)==() then goto NoTwo
  35. rem I'm not to sure about the "for" loop but I think it might
  36. rem go something like this
  37.  
  38. Move:
  39. for %A in (%1) goto CopyFile
  40. goto end
  41.  
  42. CopyFile:
  43. if exist %2\%A goto ItExists
  44. ReturntoCopy:
  45. copy %A %2
  46. del %A
  47. goto Move
  48.  
  49. ItExists:
  50. echo.
  51. echo %A already exists.  Hit Ctrl-C to avoid overwriting this file
  52. echo.
  53. pause
  54. goto ReturntoCopy
  55.  
  56. NoParms:
  57. echo.
  58. echo You must pass two parameters. The first is for the
  59. echo files you wish to move, followed by the directory
  60. echo you wish to move them to.
  61. goto Example
  62.  
  63. NoTwo:
  64. echo.
  65. echo You must specify the directory to which you want the
  66. echo files passed.
  67.  
  68. Example:
  69. echo.
  70. echo eg.  move *.bak c:\temp
  71. echo.
  72.  
  73. end:
  74.  
  75.  
  76. *** I did not test this and make no guarantees that it will work.
  77.