Earlier quoted context omitted.
Even simpler: alias del="mv -t ~/.Trash/"
Now let's delete them after roughtly 30 days: alias del="mv -t ~/.Trash/ ; find ~/.Trash/ -mtime +30 -exec rm {} \;"
Stop Using `rm` in Bash. Use `del`
61–70 of 76 posts
Re: Stop Using `rm` in Bash. Use `del`
#62Re: Stop Using `rm` in Bash. Use `del`
#63Earlier quoted context omitted.
Now let's delete them after roughtly 30 days: alias del="mv -t ~/.Trash/ ; find ~/.Trash/ -mtime +30 -exec rm {} \;"
This does not work. The arguments to `del` get appended at the end, after `find`. You want this: del() { mv "$@" ~/.Trash/ && find ~/.Trash -mtime +30 -delete } I also replaced the unnecessary exec by find's builtin -delete
And just a reminder everybody please don't run random scripts you find on the internet.
P.S. you need a semicolon before the close brace :)
Re: Stop Using `rm` in Bash. Use `del`
#64Re: Stop Using `rm` in Bash. Use `del`
#65Earlier quoted context omitted.
Now let's delete them after roughtly 30 days: alias del="mv -t ~/.Trash/ ; find ~/.Trash/ -mtime +30 -exec rm {} \;"
Correct me if I'm wrong, but wouldn't that instantly delete all moved files which are older than 30 days since mv keeps the mtime?
Re: Stop Using `rm` in Bash. Use `del`
#66garbage-io has some features that scratch my own itches:
- Trash files with the same name without clashing - Delete things from trash directory base on deletion time and file size - Hide the deleted files/directories before moving them, in case moving them takes a long time (I later think this was a bit over the top...) - The smart deletion can also be used for e.g. ~/Downloads
I do feel that a better approach would be something that works alongside the trash functionality instead of replacing it, though.
Re: Stop Using `rm` in Bash. Use `del`
#67I've never liked the idea of a trashcan, and usually shift-delete when I'm in the gui. Deleting shouldn't be done casually, but a ui shouldn't second guess a user any more than it has to.
If you’re the person in charge of making the delete operation the best and safest it can be, you do not have the luxury of yelling at users to just be more careful, because the data shows very plainly that doesn’t work (despite this being the approach most IT people seem to think is acceptable). In this role, with these constraints, the inevitable conclusion is the make a trash can.
Re: Stop Using `rm` in Bash. Use `del`
#68Earlier quoted context omitted.
Would be nice if filesystems were garbage collected, though. I don't see a fundamental reason why rm couldn't be undoable the second after you issue it.
Most have SSD drives now that trims the space on delete. Not sure how easy it is to mark regions on the SSD for "undelete" when it has been trimmed. In some cases the deleted region of the drive may even be mapped to another place on the memory chip itself to cycle it.
Re: Stop Using `rm` in Bash. Use `del`
#69Earlier quoted context omitted.
Until at least an year ago, the Ubuntu version (and likely, the upstream on), wouldn't work on certain filesystems. I'm not sure about the current state, but one needs to test is very carefully before using it.
Which filesystem were you using when you encountered trouble with it? What happened when you tried to use it? Did it warn you about the filesystem issue? Did it delete rather than trash?