in reply to Re^2: How to get sub-folder names using perl?
in thread How to get sub-folder names using perl?
checks if the current directory entry (contained in $_) is a regular file (as opposed to directories or folders in MS parlance), and, if it is, goes directly to the next directory entry in the list.next if -f $_;
Update: as correctly pointed out below by Happy-the-monk, the code above will filter out only plain files (I used the words "regular files" to mean that). So that it is not completely accurate to write, as I did above, that the script will only work on subdirectories, since there can be other entities than just plain files and subdirectories. And it would be better to identify real directories with something like next unless -d $_;. Thank you, Happy-the-monk, for the added accuracy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to get sub-folder names using perl?
by Happy-the-monk (Canon) on Mar 08, 2015 at 10:54 UTC | |
by Laurent_R (Canon) on Mar 08, 2015 at 11:05 UTC |