enumerating directories (not recursive.. just 1 level)

Recommended Posts

I want to get a list of the directories in a directory to an array. I am going to use filefindfirstfile/next unless there is a better way. (know of any?)

So I have done that and I get the filenames and directories.

Now I am lost at how to detect if it is a directory or not... all I can think of is to change the directory and see if it succeeds... but obviously there must be a better. Please tell me what I am overlooking here.

Also, anyone know what function to use to get the filename only of a file? I mean strip the path? if there is not such a function, what regexp can I use to do this?

thanks

Share on other sites

1. _FileListToArray()

2.

$array = StringSplit("c:\path\to\filename.txt", "\")$filename = $array[$array[0]]

Share on other sites

1. _FileListToArray()

2.

$array = StringSplit("c:\path\to\filename.txt", "\")$filename = $array[$array[0]]

wow, cool.. that's easy

Create an account

Register a new account