Page 1 of 2 12>
Topic Options
#139766 - 2005-05-16 08:18 PM Unexpected behavior in DIR() in v4.22
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
Ruud,

Given the following files:

Myfile.xml
Myfile.xml_1

Dir("*.xml") returns both files. I would expect *.xml* to return both instead. Can this be addressed?

Thanks,

Jim
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#139767 - 2005-05-16 08:44 PM Re: Unexpected behavior in DIR() in v4.22
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
I may have also stumbled across this DIR bug and not noticed the version of Kix as being the culpret. I have a script that worked on some computers and not others. I know it had to do with DIR(*.log). If I get a chance I'll see if I can reproduce it.
_________________________
(... better days ahead)

Top
#139768 - 2005-05-16 09:53 PM Re: Unexpected behavior in DIR() in v4.22
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jim,
Have you tested this in 4.5? 4.22 has been out of beta for some time now.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#139769 - 2005-05-16 11:30 PM Re: Unexpected behavior in DIR() in v4.22
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Jim,

Tried the following bit of code and it works fine.
Code:

cls
break on
?@kix
$FileName = Dir("C:\!chkout\*.xml*")
While $FileName <> "" and @ERROR = 0
? $FileName
$FileName = Dir() ; retrieve next file
Loop
get $



And.. Get the following results:
Quote:


4.22
test(1).xml_1
test.xml

4.50 Release Candidate 1
test(1).xml_1
test.xml





HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#139770 - 2005-05-16 11:34 PM Re: Unexpected behavior in DIR() in v4.22
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Kent, I think Jim's problem was it was showing all files when the line is like this:

$FileName = Dir("C:\!chkout\*.xml")

(Doesn't have the second "*"...)

And I can't seem to put my hands on my buggy script right now
_________________________
(... better days ahead)

Top
#139771 - 2005-05-16 11:42 PM Re: Unexpected behavior in DIR() in v4.22
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I take out the second * and it works fine in both versions.

Guess we'll have to wait until Jim gets back

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#139772 - 2005-05-16 11:58 PM Re: Unexpected behavior in DIR() in v4.22
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Jim,

I assume you posted in the Beta forum in order to hopefully have Ruud address this in the upcoming 4.5 not older versions already released.

However, try running this on an NT 4.0 system (and maybe Windows 2000 prior to service pack updates). I believe this is the default behavior of the Microsoft APIs on Windows XP.

Try the same search in Windows Explorer or Windows Search and I think you'll find the same results. Microsoft assumes you're stupid so they will search for EVERYTHING even though you didn't specify it.

Not saying Ruud can't possibly address it, but I don't believe this behavior exists in older OS versions.

Top
#139773 - 2005-05-17 12:06 AM Re: Unexpected behavior in DIR() in v4.22
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Doc I think you are right. I just opened a command prompt in XP and typed "dir *.xml" and got results as though I typed "dir *.xml*". WTF?



Edited by Allen (2005-05-17 06:03 AM)
_________________________
(... better days ahead)

Top
#139774 - 2005-05-17 12:23 AM Re: Unexpected behavior in DIR() in v4.22
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
WTF is right?!?!?! I can't believe my eyes...

Hopefully this can be addressed as I think this type of accuracy is crucial. Oh, and expected... =)

DOC and LES, I posted in this forum b/c traditionally this is where all bugs were posted and if confirmed, then, yes, I would expect to see it implemented in the next release assuming Ruud concurs.

Les, I haven't even begun using 4.23 and wont adopt 4.5 in production until it's out of beta and well established.
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#139775 - 2005-05-17 02:19 AM Re: Unexpected behavior in DIR() in v4.22
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I don't expect you to put a beta into production, but when it comes to reporting bugs, I expect that you would confirm whether it still exists in the latest beta or gold if there is no current beta. One cannot expect a re-release of an old version of KiX now can we?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#139776 - 2005-05-17 02:37 AM Re: Unexpected behavior in DIR() in v4.22
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Jim, using DIRPLUS you can get around this retarded XP "feature".

Code:

$=setoption("WrapATEOL","ON")
break on
for each $file in dirplus(@scriptdir, "/f xml")
? $file
next



Lets hope someone comes up with a magic cure.
_________________________
(... better days ahead)

Top
#139777 - 2005-05-17 02:43 AM Re: Unexpected behavior in DIR() in v4.22
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
is it an XP feature ? whats it called ? couldn't google around it.

btw - thanks for pointing this weird feature out - didn't even notice it before. kinda of annoying actually.

Top
#139778 - 2005-05-17 02:57 AM Re: Unexpected behavior in DIR() in v4.22
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Me and Doc were discussing this insane behavior on MSN and he called it a "By Design feature"...

I've been searching too... but as yet, not found a thing
_________________________
(... better days ahead)

Top
#139779 - 2005-05-17 04:59 AM Re: Unexpected behavior in DIR() in v4.22
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Found some information over at codeguru:

Work Around the Bug of "Deprecated DOS Wildcards"

Seems to be something to do with the win32 FindFirstFile() API.

Command Prompt's Treatment of Long File Extensions

-Shawn

Top
#139780 - 2005-05-17 06:52 AM Re: Unexpected behavior in DIR() in v4.22
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Surprisingly, this "feature" has been around at least since Windows 2000...

Anyone have a NT 4 box to verify its actions?
_________________________
(... better days ahead)

Top
#139781 - 2005-05-17 12:28 PM Re: Unexpected behavior in DIR() in v4.22
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
This behaviour is determined by the Win95TruncatedExtensions registry setting.

More details can be found in: http://www.microsoft.com/technet/prodtec...363d823f17.mspx

Regards,

Ruud

Top
#139782 - 2005-05-17 06:34 PM Re: Unexpected behavior in DIR() in v4.22
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Thanks for the post Ruud. Last night I had tried that very reghack and it did not appear to work on XP. However after a little further testing, it does work, but in a limited capacity. Anyone care to reproduce my work here:
 
Create a temporary directory
In this temp directory
  Create file1.txt
  Create file2.txt_old
 
dir *.txt (should display both files)

Now do the reghack: set(HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\Win95TruncatedExtensions) to 0
Reboot
 
dir *.txt (both files will be displayed)
create file3.txt_old
dir *.txt (file1 and file2 will be displayed)
 
If someone can reproduce the results I got, it appears that this reghack addresses only one part of the equation. When newly created files are written it creates them with the 8.3 structure and then dir, del, etc works like it has in the past. However it doesn't address all the existing files, which are still displayed incorrectly (dir), or at worst, accidentally deleted by an del command and a misplaced "*".
_________________________
(... better days ahead)

Top
#139783 - 2005-05-17 08:01 PM Re: Unexpected behavior in DIR() in v4.22
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Same results for me Al.
Top
#139784 - 2005-05-17 08:06 PM Re: Unexpected behavior in DIR() in v4.22
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Here is an example output.

dir *.xml* /x
COPYOF~1.XM~ Copy of two.xmls1
one.xml
THREE~1.XML three.xmlt
TWO~1.XML two.xmls

dir *.xml /x
one.xml
THREE~1.XML three.xmlt
TWO~1.XML two.xmls

Here is another example. Notice how the /x switch has a ~1 even on the name and a ~ on the end of the extension.

DIR TES*
TEST.XML
TEST1.XMLS

DIR TES* /X
TEST.XML
TEST1~1.XM~ TEST1.XMLS


Edited by NTDOC (2005-05-17 08:12 PM)

Top
#139785 - 2005-05-17 09:21 PM Re: Unexpected behavior in DIR() in v4.22
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
This greatly complicates matters and is a liability. I can't imagine us having to program to this quirky behavior or having to document this in every script that works with wildcards.

Ruud, can you change dir(), copy, del, etc. to work the good ol' way?
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
Page 1 of 2 12>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1636 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.119 seconds in which 0.071 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org