Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADIR() and MS-Dos File names
Message
From
30/10/2002 11:03:11
 
 
To
30/10/2002 10:47:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00716893
Message ID:
00716900
Views:
16
>I am using Adir() to check a directory for a set of files. A weird thing is happening. Adir() says a file exist but I can't find it. Here's what I found out. Using NT4 and the properties of a file shows the file name and the MS-Dos name of the file which I have found out don't always match. In this case the MS-Dos name for 849710-409A was '852202E'. Just so happens I was using Adir() to find '852202' which it says it found but not really. Is there any way around this?

Instead of ADIR(), use the Scripting.FileSystemObject to open a Folder object and then examine its Files collection - each file object has both the Long File Name and Short File Name (MS-DOS Name) as a property:
oFSO=CREATEOBJ('Scripting.FileSystemObject')
oFolder = oFSO.GetFolder('C:\MyDirToSearch')
FOR EACH oFile IN oFolder.Files
   ? oFile.Name, oFile.ShortName
ENDFOR
The FSO preserves case, but you'll have to implement your own filter on the Files collection of a Folder object. You can try to retrieve a specific file name using the FSO's GetFile() method.
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