Using a automated script file

Microsoft Windows 7 ultimate 32-bit
October 1, 2014 at 06:43:41
Specs: Windows 7, n/a
I am deleting a folder using a script file:
rmdir c:\test /s /q
Sometimes when there is a subfolder in c:\test I will get an error stating The directory is not empty.
It does not give me this error all the time. Is there anything I can do prior to issuing the command to empty the folder so the script will execute successfully?

See More: Using a automated script file

Report •

October 1, 2014 at 11:00:53
The only way I know is to use Del with *.* and point it to the contents of the sub-folder - only OK if you know its name.

You might do better with this on the Programming forum so I'll ask the mods if they are prepared to shift it.

Always pop back and let us know the outcome - thanks

message edited by Derek

Report •

October 1, 2014 at 12:28:25
This is because the file that throws the error is probably in use. You will have to close the file or program thats using the file for the command to run properly.


ASCII Question, Get an ANSI

Report •

October 1, 2014 at 14:27:19
The folder I am removing is on a Windows Web Server. Prior to deleting the folder, I have a command in the script which stops IIS.

Report •

Related Solutions

December 4, 2014 at 12:09:09
There may be multiple reasons why he can't delete some file in some folder, it can be a mess.

At least try to set your parameters correct, like this:

C:\>rmdir /?
Removes (deletes) a directory.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

Report •

Ask Question