Announcement

Collapse
No announcement yet.

Batch File Move

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch File Move

    This may sound like a simple question (and it maybe) but.........

    I have a folder

    D:\MonthlyUpdate\

    Once a month an update is placed in the folder then a script is run which does some stuff with the files in it. What I want to do is when the script has finished move the folder to somewhere else on the drive.

    The problem is that the folder is a random name (e.g. DE502_2 one month and DE502_3 the next). I know I can copy the folder and then delete but since it contains 6GB+ of data it will take too long.

    Code:
    move /Y D:\MonthlyUpdate\DE502_2 D:\Done
    works perfectly, but I cannot do

    Code:
    move /Y D:\MonthlyUpdate\*.* D:\Done
    as this only moves files, and the move command does not have a subfolder switch.

    Any Ideas ??

    topper
    * Shamelessly mentioning "Don't forget to add reputation!"

  • #2
    Suppose you could use xcopy and then have a del afterwards but dunno what performance hit you will get instead of using move.
    Server 2000 MCP
    Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Hi Tonyyeb,

      Yea thought of that but it would take up a) too much disk space in the interim, b) too intensive for too long.

      Anyway's I found the answer (thinking outside the box !!)

      To run from command line
      Code:
      FOR /D %I in (D:\MonthlyUpdate\*.*) DO move %I D:\Done
      To run from in Batch File
      Code:
      FOR /D %%I in (D:\MonthlyUpdate\*.*) DO move %%I D:\Done
      topper
      * Shamelessly mentioning "Don't forget to add reputation!"

      Comment

      Working...
      X