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;
In reply to Re: Unlink files but not in pwd
by baxy77bax
in thread Unlink files but not in pwd
by athanasia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |