Script & command to empty .recycle no longer works

bassmann

Dabbler
Joined
Oct 18, 2017
Messages
17
Hi there,

I had a script to auto empty the .recycle bin but it seems to have stopped working for some reason and its collecting a lot of garbage. I tried the commands from the script directly in the Command Shell. They don't throw any errors, but they don't empty the .recycle bin either.

Some of the files in .recycle were deleted 2yrs ago but I've specified a time of 7 days in the command.
I'm wondering if something has changed in a upgrade at some point???
I'm running Truenas 12.0 u4

The commands I'm trying to run are:

Code:
find /mnt/Pool/myShare/.recycle/* -atime +7 -exec rm -rf '{}' \;
find /mnt/Pool/myShare/.recycle/ -depth -type d -empty -exec rmdir {} \;


or

Code:
find /mnt/Pool/*/.recycle/* -atime +7 -delete;
find /mnt/Pool/*/.recycle/ -depth -type d -empty -exec rmdir {} \;



Any thoughts on what my issue could be?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
ZFS usually prevents actions across dataset boundaries as a data safety mechanism. Try cd'ing into the dataset first.
 

bassmann

Dabbler
Joined
Oct 18, 2017
Messages
17
Thanks, that's a good suggestion. I gave it a go but does not make a difference.
I checked folder permissions too which seem ok. Both user and group have rwx and group is wheel.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
What happens when you run the commands manually in a shell?
 

bassmann

Dabbler
Joined
Oct 18, 2017
Messages
17
Hi - I was running it from a shell...

...I think i've found the issue though. The .recycle folder is being archived in my daily backups. I think the -atime option in find is flagging accessed at last backup so 7days is never reached.

I'm going to test this by excluding .recycle folder from my backup procedure.
 
Top