Deleting Empty Folders - VisualCron - Forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Guest
13 years ago
hi,
How do i delete empty folders?

I ve merged several folders files into one folder but have several empty folders which i want to delete.

Sponsor
Forum information
ErikC
13 years ago
You can use a batch file for this.
Execute it with the execute task an use 1 parameter as the top level dir.

for /f "tokens=* usebackq" %%d in (`"dir "%1" /ad/b/s | sort /R"`) do rd "%%d"
ECHO endofscript


What it does is deleting all the empty dirs staring at the deepest level.
The ECHO on the last line removes the error from the task wen deleting non empty dirs.

Regards,
Erik
Uses Visualcron since 2006.
Guest
13 years ago
Thanks Erik!

Just a bit confused why I have to use a batch file when there is a delete folder option in tasks.
Support
13 years ago
Originally Posted by: afruish 

Thanks Erik!

Just a bit confused why I have to use a batch file when there is a delete folder option in tasks.



Delete folder option is for the File delete Task. There is no specific Delete folder Task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Guest
13 years ago
Why is there a delete folder option in the file delete task options if you cant delete folders?
Support
13 years ago
Originally Posted by: afruish 

Why is there a delete folder option in the file delete task options if you cant delete folders?



You can delete folders in that Task but it was not made to point out a folder for deletion. It was made for finding files and then delete folders where files where found (and deleted and now empty folder).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
13 years ago
An example to make this clear:

Let say you specify folder c:/test in the File delete Task with option "delete empty sub folders".

c:/test has two sub folders:

c:/test/folder1 <- this is empty
c:/test/folder2 <- this contains a file that matches the file filter

Now, the file filter will only find the file in folder2. And after deletion of that file it will notice that folder2 is empty. Now, it deletes folder two.

Folder1 will never be found and excluded because it did not match a file with that file filter.

What you might request is a "Delete folder" Task which you can just specify a start folder on and a _folder mask_ for. * for delete all.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Guest
13 years ago
oh i see :-)

Let me have a play with that.

cheers Henrik
Guest
13 years ago
"and a _folder mask_ for. * for delete all"


what does this mean? i cant see a folder mask in that window.
ErikC
13 years ago
Hi afruish,

Henrik was talking about a feature request you might want to post, not about something already in place.

Regards,
Erik
Uses Visualcron since 2006.
Scroll to Top