Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Solved] Cleaning up empty folders on /disk*/ shares

Featured Replies

So because I'm an idiot I started a run of the unbalance plugin to move files off a drive so i can drop it from the array, then had to stop it because I included a disk I didn't mean to.

 

rsync created empty directories on the destination disks first so I now have a bunch of empty folders on the /mnt/disk* shares that don't correspond to the actual location of the data. I would like to delete the empties but am looking for a sanity check to make sure my methodology is sound and I'm not going to break things.

 

https://www.reddit.com/r/unRAID/comments/9chbca/user_share_splitting_and_clean_up/

FIND:
for i in {1..6};   do find /mnt/disk$i/ShareName -type d -empty -print; done

FIND & DELETE:
for i in {1..6};   do find /mnt/disk$i/ShareName -type d -empty -delete; done

This seems promising, works on the share level, and can be scaled across all the disks in the array.

 

Can anyone foresee any problems with running one of the above commands and clearing out the empty folders on a share by share basis? I figure by working at the share level I avoid accidentally deleting a top level share that may be empty for whatever reason.

 

 

EDIT: Well I gave it 48 hours and I couldn't come up with any negative effects so I went for it. It doesn't seem to have had any ill effects, no missing data, etc. Consider this solved.

Edited by weirdcrap

Solved by weirdcrap

  • weirdcrap changed the title to [Solved] Cleaning up empty folders on /disk*/ shares
  • 1 year later...

Hey! I have the same issue. I'm trying to break the habit of using Unbalance, but I've been using it for a while now and accumulated a lot of empty folders.

 

Since running that, any issues? Just always want to be extra cautious about doing any scripted deleted commands.

  • Author
  • Solution
15 hours ago, s449 said:

Hey! I have the same issue. I'm trying to break the habit of using Unbalance, but I've been using it for a while now and accumulated a lot of empty folders.

 

Since running that, any issues? Just always want to be extra cautious about doing any scripted deleted commands.

I had no problems with the commands above that I can recollect. Just be sure to run FIND before you run FIND & DELETE to make sure you aren't getting anything included you don't want.

Edited by weirdcrap

  • 2 weeks later...
On 7/13/2021 at 7:41 PM, weirdcrap said:
do find /mnt/disk$i/ShareName -type d -empty -print; done

Hi, I can't get this command to work. It says syntax error near unexpected token `do' 

 

In my case I typed do find /mnt/disk$6/Movies T-NET Server -type d -empty -print; done and then pressed enter.

 

What am I doing wrong?

On 11/13/2022 at 9:49 AM, Teejoo said:

What am I doing wrong?

I would guess that you probably need some kind of quotation marks if your share name has a space in it.

Not sure if it's 'quotation mark' or "quotation mark" or something else as I am not very comfortable with linux command line myself.

  • Author
11 hours ago, ChatNoir said:

I would guess that you probably need some kind of quotation marks if your share name has a space in it.

Not sure if it's 'quotation mark' or "quotation mark" or something else as I am not very comfortable with linux command line myself.

Yes If you have any spaces in your share name you need to either escape them or wrap the share name in quotes.

20 hours ago, weirdcrap said:

Yes If you have any spaces in your share name you need to either escape them or wrap the share name in quotes.

That will be the issue. However, I solved it making the disc a share and deleted them using explorer.

  • 2 years later...

I am trying to locate all the empty folder on a share. When I run this "find /mnt/disk1/movies -type d -empty -print" it just reports back with all the folders on the share, not just the empty ones. Am i missing something? Thank you

  • Author
1 hour ago, johnzimm said:

I am trying to locate all the empty folder on a share. When I run this "find /mnt/disk1/movies -type d -empty -print" it just reports back with all the folders on the share, not just the empty ones. Am i missing something? Thank you

Your command is working as expected for me, only empty folders were returned. UnRAID V7.0.1

find /mnt/disk13/Movies -type d -empty -print
/mnt/disk13/Movies/Robin Hood (1973)
/mnt/disk13/Movies/Deep Water (2022)
/mnt/disk13/Movies/Spider-Man (2002)
/mnt/disk13/Movies/Big Lebowski, The (1998)
/mnt/disk13/Movies/Happiness (1998)
/mnt/disk13/Movies/John Wick Chapter 2 (2017)
/mnt/disk13/Movies/Semi-Pro (2008)
/mnt/disk13/Movies/Fifth Element, The (1997)
/mnt/disk13/Movies/Tour De Pharmacy (2017)
/mnt/disk13/Movies/Gladiator (2000)
/mnt/disk13/Movies/Logan Lucky (2017)
/mnt/disk13/Movies/A Quiet Place Day One (2024) {imdb-tt13433802}
/mnt/disk13/Movies/The Peoples Joker (2023) {imdb-tt21651430}
/mnt/disk13/Movies/Cuckoo (2024) {imdb-tt12349832}
/mnt/disk13/Movies/Emilia Pérez (2024) {imdb-tt20221436}
/mnt/disk13/Movies/Only the River Flows (2023) {imdb-tt27590147}
/mnt/disk13/Movies/Prince of Broadway (2010) {imdb-tt1000769}
/mnt/disk13/Movies/Indian in the Cupboard, The (1995)

I'm not sure why this wouldn't work for you. Is your UnRAID version up to date? Maybe an issue with the find command on your specific version?

22 hours ago, johnzimm said:

I am trying to locate all the empty folder on a share. When I run this "find /mnt/disk1/movies -type d -empty -print" it just reports back with all the folders on the share, not just the empty ones. Am i missing something? Thank you

It's working as expected for me. Are you sure the folders shown on that disk actually have data? your share may have data in that folder but it is stored on a different disk.  Look at the folder on disk1 only, don't look at the share.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.