TD-16824: SalListFiles not finding all files
TD-16824: SalListFiles not finding all files
SalListFiles() does not find files which have neither of the attributes "ReadOnly", "Can bei Archived" or "Index for Search" set. If at least one of the attributes is checked in the (extended) file properties it will be found.
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?
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?
You do not have the required permissions to view the files attached to this post.
Re: TD-16824: SalListFiles not finding all files
I get the same and tested on:
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.
MartinD
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.
MartinD
You do not have the required permissions to view the files attached to this post.
Re: TD-16824: SalListFiles not finding all files
Thank you Martin,
but your code is not in TD 5.2 format.
but your code is not in TD 5.2 format.
Re: TD-16824: SalListFiles not finding all files
"but your code is not in TD 5.2 format." -- Pretty simple to back-convert by hand, Peter. Just change '41' to '39' then read in with TD v5.2 and for each warning just hit OK button.
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.
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.
You do not have the required permissions to view the files attached to this post.
Re: TD-16824: SalListFiles not finding all files
Thank you, Jeff.
Re: TD-16824: SalListFiles not finding all files
I know this is an old topic now but it sort of helped me fix something. I was using SalListFiles but was missing files with no archive flag set.
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.
Thanks
Keith
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.
Thanks
Keith
Re: TD-16824: SalListFiles not finding all files
For anyone (like me) who didn't know the term 'UNC path' here's some info:
http://en.wikipedia.org/wiki/Path_%28computing%29
and here:
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
http://en.wikipedia.org/wiki/Path_%28computing%29
and here:
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.
Re: TD-16824: SalListFiles not finding all files
The problem is VisDosEnumFiles can't find any files in a UNC path.
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!
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