On Sat, 2007-11-17 at 15:53 -0800, Randall R Schulz wrote: > On Saturday 17 November 2007 15:41, Bryen wrote: > > On Sat, 2007-11-17 at 15:30 -0800, Randall R Schulz wrote: > > > ... > > > > > I've known users (dare I say, "lusers") to override rm with a > > > script that moves the target files to a trashcan folder. > > > > Hmm... That would be an interesting project to try to create. What a > > way for me to flex my current knowledge and expand on it. :-) > > It's no big deal. Write an "rm" replacement script that moves files to a > specified trash folder rather than simply unlink them. The only thing > you really have to worry about is name clashes. When that happens, add > a suffix (making sure that the suffix is unique, of course). With a bit > more work, you could additionally mimic the file system hierarchy > within the trash folder, but that doesn't get you out of handling > multiple deletes of the same name (since files often get recreated > after they're deleted). > Here is an easy bash script one dates files the other takes a prefix. change cp to mv and pick your target directory. With command pwd you get the present working directory so if you later go to your trash directory you can read where the file came from.
cat CopyWithDate.sh #!/bin/sh for i in `ls -A`; do cp -v $i /home/cwsiv/Documents/$(date +%F).$i; done cat CopyWithPrefix.sh #!/bin/sh echo Needs detection for empty string if [$1=""]; then echo Provide a Prefix to be used fi #for i in `ls -A`; do # cp -v $i /home/cwsiv/Documents/$1.$i; #done ___ _ _ _ ____ _ _ _ | | | | [__ | | | |___ |_|_| ___] | \/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
