Please reproduce by opening the properties of the attached file TestAttributes and switch off the above 3 attributes. Now the file will not be listed. If at least one of them is switched on it will.
Is there any known workaround?
Local drive WinXPSP3, TD 5.2SP4 & TD 6.0 SP3. Also on Windows Server 2008R2 hosting the file.
Looked in the help file and couldn't see much, but then found VisDosEnumFiles. From that Help page it looks like FA_Standard doesn't find files with the Archive Bit ON. So I would conjecture that it won't find files with the other two attributes turned off either.
But I changed your code to use VisDosEnumFiles and VisListArrayPopulate and it works fine. So I would think it is either a BUG, or the Help file needs to better explain this for SalListFiles.
In any event, I modified your test app to include VisDoEnumFiles(), just to see what's what for myself. I'll attach it along with 4 versions of your text file, each name with what if any attributes it has set for it.
Proof is in the images:
SalListFiles() - missed the file with NO attributes set VisDosEnumFiles - does catch that file OK Workaround is to use VisDosEnumFiles.
VisDosEnumFiles finds all the files correctly but it doesn't seem be able to use UNC paths like SalListFiles can.
Is there another function that might work with UNC paths and find all the files in a folder?
I am using TD4.1 PTF2.
http://compnetworking.about.com/od/wind ... c-name.htm
As for another function, have you tried Win API functions, like described here:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Hmmm, maybe combine the returns from both calls into a single list that includes your UNC paths as well?VisDosEnumFiles finds all the files correctly but it doesn't seem be able to use UNC paths like SalListFiles can.
E.g. I map a drive 'Z' to \\server\folder\ then
a) calling VisDosEnumFiles on Z:\myfiles will find all files
b) calling VisDosEnumFiles on \\server\folder\myfiles will find no files (it does not return an error either)
c) calling SalListFiles on Z:\myfiles will find all files with at least one of the three flags set
d) calling SalListFiles on \\server\folder\myfiles will find all files with at least one of the three flags set
One option was to map a drive but this would require some of our servers to stay logged in. Using UNC paths allows the server to remain at the login prompt while apps run as scheduled tasks.
The option I went with was to change the code back to using SalListFiles but before calling it I use VisFileSetAttribute to set the archive flag for every file in the folder.
My IT manager wasn't happy as some files may get backed up twice but at least my app can find them.
Thanks for all the help. I would never have guessed it was anything to do with file attributes in the first place!
Who is online
Users browsing this forum: [Ccbot] and 0 guests