Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADIR not retreiving all directory filenames into DBF
Message
From
27/10/2002 14:17:16
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00715886
Message ID:
00715889
Views:
17
>Hi,
>
>I seem to be having a problem with retrieving ALL filenames & file info into a Dbf using the ADIR() and APPEND command. I use the following code:
>
>USE DirPhotos IN 0 ALIAS DP EXCL
>SELECT DP
>ZAP
>
>DECLARE aDirJpgFiles(1,5)
>ADIR(aDirJpgFiles,(mHomePhotos_PAW)+'*.JPG')
>APPEND FROM ARRAY aDirJpgFiles
>RELEASE aDirJpgFiles
>BROW
>
>Anyone see any problems with the above code? If so, what would be the proper coding or work around?

Depending on what you want, possibly lots. At a minimum, if you are examining a single directory, by default ADIR() will not include files flagged with the "Hidden" or "System" flags - that's easily fixed by adding a third, optional parameter expression, "HS", after the file mask specification. ADIR() by it's nature operates only in the specified directory; it does not recurse subfolders with the file mask, and will not find folders that match the file mask unless there is a "D" in the optional third parameter, and if they are included through the optional parameter, can only be identified as subfolders by inspecting the 5th, attribute, element of the array row for a 'D' in the string.

The full path is not included in the file name, so you'll want to record the path along with the file name when building the list in your table.

File names may be either LFNs or the older 8.3 short name version, largely dependent on how the file specification is done in the shortcut that launches the app. Something to be aware of if you are dependent on one format or the other.

Then there's the issue of some JPEG files having a file type of '.JPEG' rather than '.JPG', and an array size limit of 13,000 file names in a folder if you get some folders with a horrendously large number of JPEGs in them.

There are entries in both the FAQ and Download sections that expand on the functionality of the native ADIR().
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform