Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: For loop with xcopy  (Read 4461 times)

0 Members and 1 Guest are viewing this topic.

jake74

  • Guest
For loop with xcopy
« on: September 01, 2005, 12:23:47 PM »
I've got a directory with sub directories like this:
--1001
   --1001
      -----Bunches of files and dirs
--1002
  --1002
      -----Bunches of files and dirs
I want to move the contents of sub-directory 1002 up one level, then delete the 1002 sub-directory folder.

Here's what I'm trying to do (pseudo code)

for each %var% in <dir /B /A:D> (or a text file with these dir's listed){
   xcopy %var\%var %var /s /e
   del %var/%var/*
}

This is the command that works:
xcopy 7614\7614 7614 /s /ce
The delete didn't work.  

Your help is much appreciated.

Jake B

earie

  • Guest
Re: For loop with xcopy
« Reply #1 on: September 08, 2005, 05:47:59 AM »
Try using:

del /q %var%\%var%
rd /q %var%\%var%


Or better yet (delede the whole folder and content together):
rd /q /s %var%\%var%

Good luck

jake74

  • Guest
Re: For loop with xcopy
« Reply #2 on: September 08, 2005, 11:25:24 AM »
Thanks!