Contents:

 

 

Introduction


News blog


What is Servoy?


Getting Started


Comparison Servoy/VFP


Performance


How-To's

 

Code Reference

 

VFP2Servoy Toolkit

 

 

Contact / feedback

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ADIR() - plugins.file.getFolderContents



Returns an array with file/directory information. In VFP you have to specify the name of the array and don't have to specify a folder (the current directory is used). In Servoy you don't have to specify the name of the array but must specify the name of the folder. The ADIR() function therefor deviates from the VFP functionality and conforms to the Servoy way of doing it.

There are more differences. In VFP can you use wildcard characters such as * and ?. VFP fills a two-dimensional array with fileinfo. Servoy fills a one-dimensional array with JSFile objects which allow you to retrieve more fileinfo from the objects.

 

VFP code example

? ADIR(aTest, "c:\temp\")   && fills two-dim.array and returns filecount
? ADIR(aTest, "c:\temp\", "*.prg") && just get the programs
? ADIR(aTest, "c:\temp\", "???_*", "D") && just dirs starting with mask

? aTest(10,1) && filename
? aTest(10,2) && filesize
? aTest(10,3) && date modified
? aTest(10,4) && time modified
? aTest(10,5) && attributes

 

Servoy code example

var dirArray = plugins.file.getFolderContents("c:\\temp\\");
var dirArray = plugins.file.getFolderContents("c:\\temp\\", ".prg");
var dirArray = plugins.file.getFolderContents("c:\\temp\\", "", 2);

dirArray[1].getName()          // name of the file or directory
dirArray[1].size()             // filesize
dirArray[1].lastModified()     // filesize
dirArray[1].isHidden()         // true if hidden
dirArray[1].getContentType()   // ie application/zip, application/pdf etc.

// alternatively:

globals.ADIR("c:\\temp\\");          // array with jsfile objects
globals.ADIR("c:\\temp\\", ".prg");  // just programs
globals.ADIR("c:\\temp\\", "", 2);   // only directories


Note: ADIR() is a function of the VFP2Servoy Toolkit

 

 

External resources:

 

vfp plugin

 

ServoyWorld 2012 pics

 

Official Servoy website

 

Ken Levy on Servoy

 

Servoy info

 

Servoy Forum

 

Servoy Documentation

 

VisualFoxpro.com © 2010-2012 • All rights reserved • Contact: info@visualfoxpro.com