delete empty folders

Get help for specific problems
Posts: 2
Joined: 14 Jun 2022

jpdevita

hello,
I would like to know if there is a function to delete empty folders.

Thanks in advance.
User avatar
Posts: 4055
Joined: 11 Jun 2019

xCSxXenon

Not is FFS. You can use a really easy robocopy command though.
Open a command prompt, navigate to the root folder, and run:

robocopy /move /s /R:0 /W:0 .\ .\

This "moves" all the data from '.\', which is the current folder you are in, to '.\', also the current folder you are in obviously. Adding the '/s' tells it to skip empty folders, thus deleting the from the "source", which is the current directory. This will most likely update the modification times of the folders, but the files will be intact.
Posts: 1037
Joined: 8 May 2006

therube

robocopy /move /s /R:0 /W:0 .\ .\
I do NOT think you want to do that.
I believe xCSxXenon misread the question.

(I might be wrong, but better to be wrong then sorry.)
OK, I'm wrong.
That does look to work.
(Now let me think about that some...)
Posts: 1037
Joined: 8 May 2006

therube

(For Windows...)

I've not used this in a long time, but... Remove Empty Directories (aka RED).

Everything: Remove Empty Directories
User avatar
Posts: 4055
Joined: 11 Jun 2019

xCSxXenon

Nope, I read it correctly. Feel free to test the command on your own, it works perfect. I daily it at my job
Posts: 1037
Joined: 8 May 2006

therube

This will most likely update the modification times of the folders
Directory dates look to be maintained.
/s
Oddly /e looks to give the same results as /s (i.e. the empty directories are removed?
Nope, I read it correctly. ... it works
Right. (I corrected myself above.)


OK, that's nifty :-).
Posts: 2
Joined: 14 Jun 2022

jpdevita

Thank you for the answer.
But she lacked information.
I use the mirror function.
I have files that are manually moved from the source.
For the target, the files are deleted but not the folders

Thanks in advance
User avatar
Posts: 4055
Joined: 11 Jun 2019

xCSxXenon

What does any of that mean or have to do with deleting empty folders?
Posts: 26
Joined: 21 Mar 2023

majex45

I believe I may be able to translate.
The OP has some folders which contain files. He deletes some of the files which, on occasion, leaves an empty folder.
When he Mirrors the files onto the target the copies of the (deleted source) files are deleted but not the folders which once contained them.
Posts: 1037
Joined: 8 May 2006

therube

See if this relates to your situation - if size or time filters are set:
Is FFS supposed to copy empty folders on update/mirror?