[Samba] Network Trash Folder - how to do it?

Adam Williams adam at morrison-ind.com
Mon Oct 20 17:48:46 GMT 2003

> Hello,I saw on Apple mashines connected to AppleShare Server that they had
> something called 'Network Trash Folder'. That is if some is working on a
> server volume and deletes a file from the volume, the file appears in user's
> Trash on his Desktop (but it is really placed on the server in volume's
> special folder called 'Network Trash Folder'). So he can restore the file if
> he needs.And when the user purges his Trash, the file is permanently deleted
> from server. Is it possible to make the same thing with Samba (running on
> Linux server) and MS Windows users?

There is a VFS module for moving "deleted" files to a special folder. 
Then you can share this folder as a type trash can.

We simply purge these folders with a scheduled job;  which is easy to
write using "find".  We run it every hour,  and delete files larger than
8Mb after 1 day and smaller files after 7 days.

find /usr/pcnet/trash -type f -mtime +1 -size +8192k -exec rm \{\} \;
find /usr/pcnet/trash -type f -mtime +7 -size -8193k -exec rm \{\} \;

Seems to work well enough.  "-type f" make it only look at regular
files, should avoid any wierdness if your get links or symblic links to
directories in there some how.

More information about the samba mailing list