fso.FileExists is too fussy
Nick wrote:
I have this code...
Dim fso As Object, PathName as string
Set fso = CreateObject("Scripting.FileSystemObject")
PathName = c:\blahblah
If fso.FileExists(PathName) Then
Do this and that
This usally works a treat except that when the pathname
specified has a case change.
For example
If c:\Hello.doc exists
and I set PathName = c:\hello.doc
then the fso.FileExists function returns false.
Can anyone think of a workaround for this?
Thanks in advance for any answers
Nick Shinkins
Excellent!
This means your code will also work on other, case-sensitive platforms.
No seriously, you could consider to use the (very old) dir function.
Try this:
Not(Dir(PathName) = "")
Should give the same result as fso.FileExists(PathName)
But please: post a followup here if you find a solution using only fso
and not dir.
--
Amedee Van Gasse using XanaNews 1.16.4.2
If it has an "X" in the name, it must be Linux?
Please don't thank me in advance. Thank me afterwards if it works or
hit me in the face if it doesn't. ;-)
|