Return Directory as List In Client

Post Reply
Danny
Member
Posts: 27
Joined: Wed Dec 08, 2010 5:59 pm

Return Directory as List In Client

Post by Danny »

Hello,

I'm trying to create a script expression for Switch Client. I'd like to have the user choose from a drop down list of folder already created on the server. I'm not sure if this can be done and am looking for help.

If anyone has something like this or could get pointed in the right direction, I'd appreciate it!



Thanks



Danny
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Return Directory as List In Client

Post by dkelly »

What determines the "drop down list of a folder"? Should the script read the contents of a directory and return the list of subdirectories?
Danny
Member
Posts: 27
Joined: Wed Dec 08, 2010 5:59 pm

Return Directory as List In Client

Post by Danny »

Yes, I was hoping to have the script point to a certain folder and list the folders with it.

So, it would watch an "Active Jobs" folder for example and list the folders, not the contents of any of the folders. If possible could it only list the folders starting with 6 digits?



Active Jobs

1111111 A

2222222 B

3333333 C

zBackup



In the example structure above, I was hoping to have the drop down consist of the 1111111 A, 2222222 B and 3333333 C.



I guess if it showed other folders, it wouldn't be the end of the world.



Thanks
dkelly
TOP CONTRIBUTOR
Posts: 628
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Return Directory as List In Client

Post by dkelly »

var theDir = new Dir("/Server/Active Jobs");

var theEntries = theDir.entryList("*", Dir.Dirs, Dir.Name);

var list = new Array;

for (var i = 0; i < theEntries.length; i++) {

if (theEntries == '.' || theEntries == "..")

continue;

list.push(theEntries);

}

list;

Danny
Member
Posts: 27
Joined: Wed Dec 08, 2010 5:59 pm

Return Directory as List In Client

Post by Danny »

Works perfect! That's great, I wasn't even in the ball park.



Thanks a lot!
Post Reply