SPUG: Problem deleting files

rick.croote at philips.com rick.croote at philips.com
Thu Nov 30 14:39:37 CST 2000


To backup what Tim said, more so, don't use unlink <$oldfile>, use unlink $oldfile or unlink ($oldfile).

Rick





john.brittingham at attws.com@SMTP at pm.org on 11/29/2000 11:47:43 PM
Sent by:	owner-spug-list at pm.org
To:	spug-list at pm.org@SMTP
cc:	 
Subject:	SPUG: Problem deleting files
Classification:	

Sorry... Clicked before I should have .. Lets try this again..


Ok.. I'm having a problem deleting files. I have tried:

$oldfile="../html/wrt_archive/weekly_archive/*to$twodaysback*\.*";
		if ($week_day !~ /Mon/)
		{
			print "$oldfile\n";
			rm ($oldfile) || warn "having trouble deleting
$oldfile: $!";
		}

 I have also tried:
	
$oldfile="../html/wrt_archive/weekly_archive/*to$twodaysback*\.*";
		if ($week_day !~ /Mon/)
		{
			unlink <$oldfile> || warn "having trouble deleting
$oldfile: $!";
		}

I keep getting an error saying it can not find the file(s).
I can run rm ../html/wrt_archive/weekly_archive/*to$twodaysback*\.* from the
command line and it will work.

What am I doing wrong?


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list