in reply to Whoops! I deleted everything!
What am I missing?
A bunch of data apparently... (I couldn't resist.)
I know you don't want to hear this now, but you should never run (even as a test) code like this without neutering it first. Don't unlink anything but have it write the names of the files it would have unlinked to a file for inspection. Only after you are sure that it won't do anything harmful, run it on a test directory. Triple check it before you run it in a production environment.
The problem is with your $days variable. You declared it with my() twice. Apparently, that results in some freakish behavior. During the first call to File::Find::find, $days is undefined. It is properly set to 7 during the second call.
Using warnings would have helped you spot this bug early.
By the way, if ($#deletions == 0 ) is not what you mean. That will be true if @deletions has a single element as the index of that element will indeed be zero. You mean if (@deletions == 0) which will be true if @deletions has no elements.
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Whoops! I deleted everything!
by Anonymous Monk on Dec 11, 2002 at 02:15 UTC | |
by sauoq (Abbot) on Dec 11, 2002 at 02:27 UTC |