in reply to Unlink files but not in pwd
well you should define the path to the file you want to delete :)
something like this:
the point is that when you call readdir on a dir you get an array of names of the files in that dir and not the full path to the file in diropendir (DIRHANDLE, "./dir") or die "Cannot open directory $!\n"; my @l = grep (/hh.txt/i, readdir DIRHANDLE); unlink("./dir/$l[0]"); closedir DIRHANDLE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unlink files but not in pwd
by athanasia (Pilgrim) on Mar 27, 2009 at 16:23 UTC | |
by drench (Beadle) on Mar 27, 2009 at 22:15 UTC |