Jump to content
  • 0

Cleaning up empty folders?


fattipants2016

Question

Due to file placement rules, my DP member disks are riddled with empty folders.

Folder A belongs on Drive A, Folder B on Drive B; if a file is moved from folder A to folder B, folder B is created on drive A, which is then empty after the next balancing pass.

From this point forward, every time you open or interact with folder B, both drives A and B spin up because drive A still has an empty folder B on it.

Can anyone think of any clever ways to keep this scenario from happening, or automate the removal of these empty folders?

I tried telling programs to move the files to the physical drive location in the above situation, but this starts confusing DP on pretty short order.

 

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 1

I've used a piece of software to do this before  - free and available on Sourceforge.  Just run it against the physical drives in the pool.  If you want to get your hands dirty and automate it, there are various Powershell scripts available too.  Remember to re-measure the Pool after altering it's contents in a way it doesn't know about.

To keep that kind of folder artifacting from happening in the first place, you'd have to run balancing less often.  Personally I have re-balancing turned off, and let Drivepool balance on the fly rather than force it.

Might be a good suggestion as a change to how the balancing works though - make it clean up after itself.

Link to comment
Share on other sites

  • 1

Just wanted to say +1 to the idea of having an option for Drivepool to automatically delete empty folders when moving files between disks.

My usecase for DrivePool is primarily convenience, and I frequently move hundreds of large audio files back and forth between my working SSDs and archiving disks. Deleting the empty folders would make it easier for me to get an overview of where things are currently stored.

Link to comment
Share on other sites

  • 0

I found a command line program call rmempty, which you can call with a list of folders (the root of each DP disk) at one time.

I simply wrote a batch file, which I scheduled to run at the same time as my SnapRAID sync each night, and now I never have to think about it again.

It works in seconds, BTW. I had to verify that it did anything with Remove Empty Directories afterwards, because I was sure it didn't work.

Link to comment
Share on other sites

  • 0

I think the one I'm using is long abandoned. It was actually hosted at the article I found called "7 Tools To Find And Delete Empty Folders in Windows"

There's a website inside the help file, but it's no-more.

I'm not familiar enough with the rules of this board, but the program's only 37KB so someone could upload it as an attachment for posterity. 

All excitement aside, however, the program successfully deletes all of my empty folders EXCEPT the Downloads folder, and I cannot figure out why. 

Downloads is my most common empty-culprit, and also the most commonly accessed / troublesome, so I'm trying to get to the bottom of it.

Link to comment
Share on other sites

  • 0
On 8/22/2018 at 12:38 PM, fattipants2016 said:

It was actually during one of my however-often-I-remember RED work-flows I thought to post the question, since running it on 7 different drives is painful.

If you mount the pooled drives to folder paths, ... you may only need to run it once, then. :)

Link to comment
Share on other sites

  • 0
1 hour ago, Christopher (Drashna) said:

If you mount the pooled drives to folder paths, ... you may only need to run it once, then. :)

That's a fair point.

I abandoned mounting my drives to folder paths for reasons I don't entirely remember, but I may revisit this if I can't resolve my "Downloads" permission issue.

Link to comment
Share on other sites

  • 0

Just brainstorming here since I've never done it - you could use the "Location" tab in the folder's properties area, and move the folder so that it occupied the -same- folder as another, like Documents.

I just attempted this myself after clearing the Downloads folder for my user account, and got interesting results.  I approved it, and was told immediately after in a new child window:

 

Quote

Do you wan t to redirect folder "Downloads" into another system folder "Documents" located at "C:\Users\username\Documents"?  If you proceed with redirection you will not be able to separate them or restore default location.

Do you still want to proceed with redirection?

 

So it looks like you absolutely can merge the Downloads folder (location) with another typically non-empty folder (whatever you choose).  You can't un-merge them after the fact, but you could easily re-create the Downloads folder manually and just enter the path into the Location tab dialog.

Link to comment
Share on other sites

  • 0
4 hours ago, Christopher (Drashna) said:

If you mount the pooled drives to folder paths, ... you may only need to run it once, then. :)

I tried this, and it doesn't work. Remove Empty Directories does not support junction points.

And Windows 10 constantly nags you about a 'driver error' if you have disks mounted to folders but not letters.

2 hours ago, Jaga said:

Just brainstorming here

Wrong thread?

 

I got to test SnapRAID earlier when a wonky script deleted ~4,000 files before I could stop it, so until someone comes along with something new to try I'm done.

 

And this ^^, BTW, is why anyone using snapRAID without file placement rules is absolutely nuts.

If those files had been scattered across different drives there's 0 chance I would have been able to get them back.

Link to comment
Share on other sites

  • 0
12 minutes ago, fattipants2016 said:

Wrong thread?

Nope, not at all.  Was proposing a way for you to "delete" your empty Downloads folder by simply merging it permanently with another folder (like Documents, which is usually filled).  Any other non-empty directory would do the trick.

 

14 minutes ago, fattipants2016 said:

I got to test SnapRAID earlier when a wonky script deleted ~4,000 files before I could stop it, so until someone comes along with something new to try I'm done.

And this ^^, BTW, is why anyone using snapRAID without file placement rules is absolutely nuts.

If those files had been scattered across different drives there's 0 chance I would have been able to get them back.

How did it work for you?  It's one reason I use 2-parity, so I can recover from multiple drive issues.  But yeah, across a bunch of different disks is rough.  Sounds like it didn't put them in the trash bin for the respective drives either.  Nasty nasty script, whatever you're running.  :blink:

Link to comment
Share on other sites

  • 0
1 hour ago, Jaga said:

How did it work for you?  It's one reason I use 2-parity

I run double parity, also. It's 1/2 for peace of mind and 1/2 because I'm a nerd and multiple parity is seriously cool stuff.

Worked great! I've simulated a few scenarios in the past by moving files to another disk, but this was the first time I needed it.

 

I couldn't leave well enough alone, though, and finally found a solution that works Even with write-protected folders.

From an administrator-level command prompt type: "Robocopy C:\Test C:\Test /B /S /Move"

I don't understand exactly why it works, but you're basically moving a folder onto itself, but skipping (deleting) empty folders.

/B allows Robocopy to properly set attributes and permissions for system folders like Recycle Bin and .covefs. Bad stuff happens if you don't use it.

I wrote a batch to run this script on all 7 of my Drivepool disks, and it completes in under a minute. Good stuff.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...