Move to Windows Recycle Bin instead of deleting

Igor Pechtchanski pechtcha@cs.nyu.edu
Tue Jan 14 22:26:00 GMT 2003


On Tue, 14 Jan 2003, Ralf Hauser wrote:

> Is there a way to have the files moved to the windows recycle bin from
> the cygwin shell window/command line?

Yes.  In your ~/.bashrc:

RECYCLE_BIN_PATH="<location of your recycle bin>"
function rm() { mv "$@" "$RECYCLE_BIN_PATH" }

The one gotcha of the above is that "mv" will get the options passed to
"rm" - not sure if there are any discrepancies.  However, if you stick to
"rm -r" and "rm -f", you should be fine.

The procedure for finding the location of the recycle bin depends on your
operating system and your setup.  On my Win2k machine, I can simply use

RECYCLE_BIN_PATH="/cygdrive/c/RECYCLER/`ls -t /cygdrive/c/RECYCLER|head -1`"

	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list