I run Ubuntu 14.04 as file server for windows clients. Clients have mapped network shared folder to work with. When they delete files from that folder, files goes to ".recycle". I wanted to delete files older then x days. I used autotrash command:

autotrash -d 30 -T /home/etc/.recycle 

but it tells me that .recycle doesn't contain info file:

Can not find trash information directory. Make sure you have at least GNOME 2.24

I was looking at: /home/etc/.recycle/info

Latest Gnome is installed and result are same. I understand that app can't read info when files moved into .recycle. I can use command: find /path/to/files* -mtime +5 -exec rm {} \; but when files move into .recycle they keep last modification date, not date when they move into folder.

Can I create info file? Is there any solution how can I delete files older then x days from a day when files moved into some folder?

Thanks in advance.


You can set the following script to be ran every X days (using cron):


cd /home/etc/recycle_old           #Deletes old trash
rm -r ./*

cd /home/etc
mv -r ./recycle ./recycle_old      #Moves new trash to "old"-folder

It works like this:

1. There are 2 folders, recycle (which is already given) for the "recent" deleted files, and recycle_old for the "old" files.

2. Every X days all the content from recycle_old is deleted and replaced with the "recent" content from recycle

If you want to delete files older than a month, simply move the script to /etc/cron.monthly. If you want something more specific, check out how to set a cronjob.

| improve this answer | |
  • 1
    Thank you for script. As always simplest solution is the best :) This helps me alot. Thx again. – Milan Apr 28 '17 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.