2

I need to have all deleted files for all users go into a folder on another drive. Is this possible? If so, what are the commands to permanently move the trash folder(s)?

The operating system is Debian Jessie.

Thanks.

2
  • At home I do not move the kitchen trash into the living room, so I can empty the kitchen trash. And at work the cleaners empty my trash bin and dispose of the trash nightly. The same policy should be implemented on your cloud server. Commented Jul 21, 2015 at 22:36
  • If the purpose is to avoid accidental deletion of data, then using an ordinary backup strategy for all files on the system (or possibly just files under /home) using e.g. restic or similar software, would be the usual solution. Commented Mar 17 at 19:09

2 Answers 2

1

It depends on the way your system is set up. If whenever a file is deleted, it moves it into a trash directory (e.g ~/Trash/) then you can run sudo mv /home/*/Trash/* path-to-drive .

If instead you want to move every file a user deletes into a drive, then you could make a simple script in your /bin directory that goes as follows:

#!/bin/bash
sudo mv $1 path-to-drive

And then name it del. You would just have to add alias rm="del" to your /etc/bash.bashrc...

Cheers, Interesting...

1
  • This is an ownCloud server. When users delete files they go to the Trash just in case they need restored. We need the server to use a MUCH larger drive or it fills up the system drive within a couple of days. So, basically, we need any files deleted to go to a Trash folder on a different volume. I don't know if this is possible.... but I hope it is. Commented Jul 21, 2015 at 19:33
-2

Why not just create a soft link with ln?

Rather than copy from another answer here's the link. Stackoverflow: how to create a link to a directory

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.