A bug in Dir$?

------------------------------------Dim FileList List As String

mailWildPath = “/myserver/data/mail/*.nsf”

TempfileName = Dir$(mailWildPath, 0)

i = 0

While TempfileName <> “”

FileList(i) = TempfileName

i = i + 1

TempfileName = Dir$()

Wend


The code is supposed to go into a mail folder on a server and get a list of all mail databases in a given folder. It has worked for awhile until mail.nsfs with a lot of documents (like 40,000) starting showing up. It just skips over them completely. No error no nothing. It returns all other databases. why can Dir not see these files? I need a fix or a workaround.

Subject: RE: A bug in Dir$?

I suggest you use the NotesDBDirectory class instead.

I’ve never heard of any problem with Dir not showing the actual directory contents. I’d guess Rufus is on the mark in guessing that the files actually weren’t there at that moment, or had a different name.

Subject: A bug in Dir$?

Hi,

Dir$ returns only “normal files”.

“Hidden files” and “System files” are not returned. If you want these as well you have to use Dir(“c:\tmp*.*”,0+2+4)

My guess is that some of your databases have the “hidden” property turned on.

Bye

Hynek

Subject: A bug in Dir$?

Might be wildly off, but could these large mail files not have a .nsf extension at the time the code was running.

For example if compact was running against them, they might be renamed to xxxx.tmp until the compact had finished. If the agent was running at the same time as compact, it wouldn’t “see” these databases. Compact being most likely to be processing the larger files at the time (because they take longer to compact).

Alternatively if they were old databases, they may have an extension of .ns4 or .ns5 to prevent the ODS being changed in the upgrade process!

HTH - Rufus.

Subject: RE: A bug in Dir$?

All of the databases I am testing on were moved to the same directory at the same time by the same admin. Guessing they all have the same actual unix file permissions because of this but having them do a check on the unix side now.

All are R6 databases. So all *.nsf. And I tried . and * Also did 0+2+4 and 8. The one database with 40k docs never shows up.

They were all copied over to the same directory Thursday. Have tried since Friday with the same results. No one has edited/moved them in any way since Thursday.

Im asking the admins if they will go into the db that never shows up and delete something like 39k docs and see if Dir$ shows it after that.

Was thinking about using NotesDBDirectory but Im under the impression that only goes to the data directory then crawls through every db in that level and all sub directories. That would be way too slow for me as there are many many databases on the boxes this agent will run on. if I could specify a sub dir then it would be ideal, but I dont think you can.

If I can’t get Dir$ to work I dont think Im left with much options past having them make a list of the nsf’s that need to be modified. probably be a list of docs that I can scroll through in some View since there is something close to it already.

Subject: RE: A bug in Dir$?

NotesDBDirectory is probably going to be faster than you think. The rate in my local Notes directory is almost 1500 databases per second, and mine is not the world’s fastest computer. Your code running on the server, even if not in the highest-priority thread, should see similar performance. Even accessing the information over a fairly slow network, I went thru 630 server databases in 30 seconds.

Since these are apparently mail files, you could instead scan the address book for users whose mail files are on that server and get their mail file paths from there.

click this button to test the speed of NotesDBDirectory in your local Notes directory.

Subject: RE: A bug in Dir$?

I can see NotesDBDirectory just kicking back a list of DBs being fast, but just getting the actual notesdatabase object for each one seems like it would be very slow.

I am planning to use the Server/Mail Users view, well something like it. Dont think that includes all the mail.nsfs they want and also think it includes some they dont want. But having them make another view similar to it that I can scroll through seems like a reasonable request.

Subject: RE: A bug in Dir$?

What did you think I was doing when I said I was iterating through the databases? There’s no way to do that without gettig the NotesDatabase object. Of course I don’t open the database, but you don’t have to to see what its filepath is.

Subject: RE: A bug in Dir$?

I’ll definitely test it. Perfomance is a high priority. Im guessing scroll through docs in a view like Server/Mail Users would be faster though.

Subject: RE: A bug in Dir$?

Hi,

just one more guess:

In the help despription of “Dir” ther is the following part: “Dir$ always returns the names a normal files. To include other files …”

Dont know if I understand that correctly but maybe Dir$ does not use the mask-parameter at all.

Could you try to test you function using ony “Dir” <without the $> and then using the mask parameter “8”.

Otherwise I dont have any more ideas.

Hynek

Subject: RE: A bug in Dir$?

Well I just had the admins delete the majority of docs out of the 5gig 40,000 doc maildd. They knocked it down to around 1k docs. It showed up on Dir right away. Looks like Dir just doesnt read docs past a certain size or number of docs…

Subject: RE: A bug in Dir$?

Hi,

i dont think that the “document count” is the problem. The function “Dir()” is used to get/check files on the file system. It does not matter at all what kind of file these are. (The file is not even opened)

I never heard that Dir() has some problems with “large” files. (And i hope it does not, otherwise I could think of many more problems in my applications)

You should really concentrate on the file itself and its OS-settings and check:

  • you run this on Windows or not ? If not remember that linux is case sensitive for filenames and therefore *.nsf might not find AAA.NsF

  • check the file attributes like “hidden”,“read only”. Are some of them different ?

  • check even the NTFS-access settings to the file (but this should not be a problem since you can work with the database)

  • try to make a Dir() with the exact filepath instead of a loop through the directory:

“Dir(“c:\NotesData\TheLargeDatabase.nsf”,0)”

Does this find the database ?

If you really only deleted some documents in the database and your function started to work then thats really strange.

Bye

Hynek

Subject: RE: A bug in Dir$?

Its running on a solaris box, 5.8 IIRC, which I have no control over what so ever.

Im sure most of you guys know this but just in case, flavors of *nix that support large files (>2gb) store them differently. Never really read up on it much, just remembered back in the day “large file system support” flags needing to be enabled. Obviously dir doesnt just implement “ls” as I had the admin do an “ls -al” and it came back with all files, including the large one, and all the attributes were exactly the same.

So Im guessing its not really a Dir bug, might just have to fiddle with some setting with the domino server user ID or something. But going through the unix admins is a completely different story than the notes admins. Against policy for me to have access to the box so I dont even have the possibility of finding out whats really going on.

But yes it looks like anyone on *nix should have this problem. Would be nice to verify. Maybe SunOS has some different default settings that other flavors that cause this, but Im sure there are others with SunOS here.