Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Get the name of all files from directory

Author
Message
BriereAnthony
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 6th Mar 2011 02:03
As the title says, I'm wondering if there's a way to get the name of every file within a path$ folder?

Thanks for your help!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Mar 2011 09:50
Here you go, this uses the current directory (Set Dir) and lists all of its files.



baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th Mar 2011 12:09
@Batvink, just out of interest does that method check sub-directories as well (including the sub-folder in the string) or would you have to do some additional code to loop through each sub-directory? I was trying to come up with a method of doing that a while ago (can't remember why now or even if I found a solution)

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Mar 2011 13:32
@Baxslash: I think you might find a Matrix1 Utils command or two for that

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Mar 2011 13:37
Quote: "I think you might find a Matrix1 Utils command or two for that"

It wouldn't surprise me

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Mar 2011 23:00
I think I was wrong about the Matrix1 Utils, I can't find one...

http://www.matrix1.demon.co.uk/Matrix1Utils_Help/Matrix1Util_22_index.html

Agent
20
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 24th Mar 2011 21:54
Not to worry, the PERFORM CHECKLIST FOR FILES command fills the checklist with directory names as well (including present working directory [.] and parent directory [..]). If you ignore . and .. in the list, you can use any entry in the checklist that doesn't have a file extension as a list of directories within the present working directory. If you place the array population code within a function, you can recurse the function call until all subdirectories are exhausted.
BriereAnthony
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 24th Mar 2011 22:54
Hey thanks about that PERFORM CHECKLIST FOR FILES function, that's exactly what I wanted!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Mar 2011 00:29
My plug-ins don't provide a single-command answer to the problem, but they can make it very slightly easier by saving you having to save & restore the current directory:


If anyone has suggestions for how DBPro's 'getting a list of files/directories' can be bettered, then I'll be happy to hear it.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Mar 2011 10:59
Nice. I'd be impressed if that could be improved upon.

Must learn more of your commands IanM

Login to post a reply

Server time is: 2024-11-24 06:50:57
Your offset time is: 2024-11-24 06:50:57