Sign in to follow this  
Followers 0
ycomp

enumerating directories (not recursive.. just 1 level)

3 posts in this topic

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 this post


Link to post
Share on other sites



1. _FileListToArray()

2.

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

$filename = $array[$array[0]]

Share this post


Link to post
Share on other sites

1. _FileListToArray()

2.

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

$filename = $array[$array[0]]

wow, cool.. that's easy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0