Page 1 of 1 1
Topic Options
#180271 - 2007-09-08 02:19 PM Can DIR(*.*) be changed so not to return . and ..
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
I can't think of an example where I want to use . and .. as objects returned from the DIR() function, when *.* is used in the pathname. But it has to programmed in to look for and dismiss them. So can the output from the Dir() function not return . or .. please?
_________________________
Bill

Top
#180284 - 2007-09-08 04:56 PM Re: Can DIR(*.*) be changed so not to return . and .. [Re: BillBarnard]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Changing it could break too many existing scripts. There are already plenty of workarounds and alternatives like FSO.

I vote to leave it as-is.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#180285 - 2007-09-08 05:23 PM Re: Can DIR(*.*) be changed so not to return . and .. [Re: Les]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
Bill, you might try using DIRPlus() instead. It's much more flexible. Personally, I haven't used DIR for ANYTHING since I started using dirplus. You can find it in the UDF Forum.
Top
#180296 - 2007-09-09 06:54 AM Re: Can DIR(*.*) be changed so not to return . and .. [Re: BillBarnard]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
As Les says it could break many existing scripts as well as potentially remove a function that someone else could be using just because they don't post here. There are Thousands of KiXtart users and only a handful really post here or at a couple of the other KiXtart sites.

Please give something like this a try if needed. I think it was written by Jooel a while back.

 Code:
Function DirL($f)
	Dim $a[0]
	$f = Dir($f)
	While Not @ERROR
		If $f <> '..' And $f <> '.'
			$a[UBound($a)] = $f
			ReDim Preserve $a[UBound($a)+1]
		EndIf
		$f = Dir()
	Loop
	If UBound($a) 
		ReDim Preserve $a[UBound($a)-1] 
	Else
		$a = 0
	EndIf
	$dirL = $a
EndFunction

Top
#180344 - 2007-09-10 11:15 AM Re: Can DIR(*.*) be changed so not to return . and .. [Re: NTDOC]
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
Thanks all.
OK chaps, let's leave it as is.
I'll carry on using If $f<>"." And $f<>".." in my scripts.
But does anyone actually use . and .. ??
_________________________
Bill

Top
#180351 - 2007-09-10 02:58 PM Re: Can DIR(*.*) be changed so not to return . and .. [Re: BillBarnard]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
You might have better luck asking Microsoft to remove them from the DIR command! ;\) After all, the *ix systems are smart enough to not show them unless you ask.

I use the '.' in an application that manages software deployment, particularly in checking for directory synchronization.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


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

Who's Online
0 registered and 579 anonymous users online.
Newest Members
min_seow, Audio, Hoschi, Comet, rrosell
17881 Registered Users

Generated in 0.066 seconds in which 0.029 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