As far as I can tell the above code should work. I know that opendir uses the correct directory, I know that a list of files is created (@allfiles) and that @onlyfile is a list of files minus the dot files. The only bit that doesn't work is the unlink part. Can anyone tell me why? Thanksopendir(DIR, "$basedir/$mesgdir"); @allfiles = readdir(DIR); @onlyfiles = grep {!/^\./} @allfiles; foreach $file (@onlyfiles) { unlink ($file); } closedir(DIR);
In reply to Deleting specified files and directories by Sadmachine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |