3 ms·
While we're on the subject, has anyone successfully found/created a replacement for rm on OS X that moves files to the trash, but doesn't break the interface of
by JonnieCache 15y ago
While we're on the subject, has anyone successfully found/created a replacement for rm on OS X that moves files to the trash, but doesn't break the interface of rm for use in scripts?
- mikemaccana 15y agoNormal Unix method of doing this is via LD_PRELOAD, then you wrap unlink() in something that moves things to a folder. I used something - think it was libtrash - when I used Linux on the desktop, but haven't investigated what the OS X equivalent would be.
- neanderdog 15y agormtrash http://www.nightproductions.net/cli.htm http://www.nightproductions.net/cli.htm I prefer 'brew install rmtrash'
- JonnieCache 15y agoThere's lots of stuff like that out there, I'm talking about something I can actually replace the rm binary with, a wrapper that precisely maintains the rm interface as described here: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/rm.1.html http://developer.apple.com/library/mac/#documentation/Darwin... I like the idea of actually wrapping the unlink syscall, but I have no idea if/how darwin allows that.
- ordinary 15y agoYou can alias trash-cli over rm, though it ignores -i, -r and -f and instead runs recursively, forced and non-interactively by default.
- maweaver 15y agoI use trash-cli (http://code.google.com/p/trash-cli/ http://code.google.com/p/trash-cli/) on Linux, it is in Python so it shouldn't be too hard to get running on OS X (although I guess you might have to modify the location of the trash folder)