TD-16824: SalListFiles not finding all files

Report bugs and possible workarounds for ANSI TD versions
User avatar
Peter.Hugk
Germany
Posts: 340
Joined: 06 Mar 2017, 07:48
Location: Germany

TD-16824: SalListFiles not finding all files

Post by Peter.Hugk » 10 Oct 2011, 14:34

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?
You do not have the required permissions to view the files attached to this post.

UVS

Re: TD-16824: SalListFiles not finding all files

Post by UVS » 17 Oct 2011, 14:52

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
You do not have the required permissions to view the files attached to this post.

User avatar
Peter.Hugk
Germany
Posts: 340
Joined: 06 Mar 2017, 07:48
Location: Germany

Re: TD-16824: SalListFiles not finding all files

Post by Peter.Hugk » 18 Oct 2011, 07:56

Thank you Martin,
but your code is not in TD 5.2 format.

Jeff Luther

Re: TD-16824: SalListFiles not finding all files

Post by Jeff Luther » 30 Nov 2011, 01:28

"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
JL_SalListFiles_MissesFileWithNOAttrs.png
VisDosEnumFiles - does catch that file OK
JL_VisDosEnumFiles_ListsFileWithNOAttrs.png
Workaround is to use VisDosEnumFiles.
You do not have the required permissions to view the files attached to this post.

User avatar
Peter.Hugk
Germany
Posts: 340
Joined: 06 Mar 2017, 07:48
Location: Germany

Re: TD-16824: SalListFiles not finding all files

Post by Peter.Hugk » 30 Nov 2011, 08:53

Thank you, Jeff.

gbityg

Re: TD-16824: SalListFiles not finding all files

Post by gbityg » 01 May 2012, 10:45

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

Jeff Luther

Re: TD-16824: SalListFiles not finding all files

Post by Jeff Luther » 01 May 2012, 18:47

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
VisDosEnumFiles finds all the files correctly but it doesn't seem be able to use UNC paths like SalListFiles can.
Hmmm, maybe combine the returns from both calls into a single list that includes your UNC paths as well?

gbityg

Re: TD-16824: SalListFiles not finding all files

Post by gbityg » 25 May 2012, 08:15

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! :)

Return to “Bug Reports (TD 4.2 and older)”

Who is online

Users browsing this forum: [Ccbot] and 0 guests