TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I think this works!



I think my perl script is now ready to replace rm. By copying the file(s)
and then deleting them, I don't have to bother with all the syntax
changing with using mv. Also perl deals with quotes used in filenames
("my long doc name.wpd" very well. If someone find any problems with the
script (or reason not to rename rm and use this as rm and then cron a real
delete of /home/delete) please e-mail me. 

Thanks for all your help,

Ben


Ben Luey
lueyb@carleton.edu
ICQ: 19144397

The world will not evolve past its current state of crisis by using the same
thinking that created the situation.
       -- Albert Einstein
#!/usr/bin/perl
$DELETEDIR = "/home/delete";
if (@ARGV[0] eq  "") {
print "Syntax:\ndel [files and directories to delete]\n"}
else {
foreach $test (@ARGV) {
        $new .= '"';
	$new .= $test;
	$new .= '" ';
	};
if ($ENV{'HOME'} eq "/root") {
$USER = "root"}
else {
$USER = "$ENV{'LOGNAME'}"};
if (!-e "$DELETEDIR/$USER") {
`mkdir $DELETEDIR/$USER`};
{`cp -f $new $DELETEDIR/$USER/`;
`rm -f $new`}}