You are not logged in.
I want to have a folder on my desktop that will automatically delete any files or other folders I put into it as a general trash can. While I know there are plenty of trash can/recycle bin style programs, I haven't found anything that just deletes everything I put into it.
Offline
Do you want the file to be deleted immediately, or do you want to wait until you reboot / shutdown. If reboot / shutdown is ok, you could always create a tmpfs mount point on your desktop, that way the files are moved to ram and thus deleted when you poweroff or restart.
Offline
If you're happy with a slight delay, just crontab an `rm -Rf /home/flameslicer/Desktop/deleteme/*` every 5 minutes.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
You could install and mount a fuse "nullfs". There is a package in the AUR, I don't know how well it works.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
#!/bin/sh
trash=/home/YourName/Desktop/TrashCan
inotifywait -m $trash | while read line; do
rm -rf $trash/*
done
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Online
Trilby's solution is the most elegant... One minor fix is to double-quote $trash if is has any spaces in the path.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Maybe something like nullfs?
OVERVIEW
nullfs is FUSE filesystem driver which discards
all files' data written to it.
Could be fun to try anyway...
::::edit: just realized this was already posted by @progandy, my bad
Last edited by CarbonChauvinist (2018-04-18 01:44:25)
"the wind-blown way, wanna win? don't play"
Offline
Deletion error recovery is the (only?) payoff for dealing with trash, right? I'd likely loose sleep without my usual year+ heap of trash "error insurance".
Thinking the 'find -mtime XX -delete /path/to/trash' command could be useful and avoids parsing ls. Reboot systems only when required, so cron or systemd timer.
Properly set up, a system could delete the trash contents daily of everything older than XX days, maintaining an inventory based on age. Downside, this would be significantly more complicated than writing a simple script as already suggested.
Last edited by Cody Learner (2018-04-18 07:32:59)
Self designated Linux and Bash mechanic.....
I fix and build stuff hands on. I'm not opposed to creating a mess in obtaining a goal.
Offline
I am befuddled.
If you want to delete something, just delete it.
If you want to pretend to delete something (send it to the recycle bin), just move it to a folder and delete the folder's contents later.
Offline
Thinking the 'find -mtime XX -delete /path/to/trash' command could be useful
I second that as yet a better approach.
While my inotify script really does precisely what the OP asked for, it seems to be a bit of a silly thing to ask for: one mismovement of the mouse on the desktop and you could destroy important data.
Downside, this would be significantly more complicated than writing a simple script as already suggested.
It doesn't need to be. A systemd user service and/or timer with just that find command would be very efficient.
Although keep in mind that mtime will not be the time the file was moved to the trash, but rather the last time the content of the file was modified. So this might mean files moved to the trash might become eligible for deletion right away. Just the same, having this on a timer script means the file will not be deleted instantly, so if you make a mistake, you can pull the file back out of the trash before it vanishes.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Online
Thinking the 'find -mtime XX -delete /path/to/trash' command could be useful and avoids parsing ls.
I take this approach to my ~/Downloads/ folder. Runs each night to delete downloads older than 1 week.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Cody Learner wrote:Thinking the 'find -mtime XX -delete /path/to/trash' command could be useful and avoids parsing ls.
I take this approach to my ~/Downloads/ folder. Runs each night to delete downloads older than 1 week.
*runs off to do this as well*
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline