Notifications
Clear all

[Closed] getSavePath() Folder name

You could try the .net directory class… maybe that’s faster? I think it’s “system.io.directory” and it has a getDirectories method.

EDIT: http://msdn.microsoft.com/en-us/library/system.io.directory.aspx

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i’ve checked .NET…
(dotnetclass “system.io.directory”).GetDirectories … is 2.5 times slower then MXS getDirectories…

ok then , thank , I check this out a bit more

ho really, then I definitely need to check this out , because I needed this stuff at the moment anyway , Thank guy !

i’ve checked .NET…
(dotnetclass “system.io.directory”).GetDirectories … is 2.5 times slower then MXS getDirectories…

damn … I incorporated in mine …anyway I found my mistake was missing = on last part now the count is good


(
fn GatherSubFolder Rootfolder =
	(
	DirClass=dotnetclass "System.IO.Directory"
	--//--
	TreeStruct=DirClass.GetDirectories Rootfolder
	FinalPath = #()
	NeedCheck = #()
	--//--
	if TreeStruct.count != 0 then
		(
		for f in 1 to TreeStruct.count do
			(
			if (DirClass.GetDirectories TreeStruct[f]).count > 1 then 
				(
				append NeedCheck TreeStruct[f]
				)
			else
				(
				append FinalPath TreeStruct[f]
				)
			)
		)
	--//--
	while NeedCheck.count != 0 do
		(
		append FinalPath NeedCheck[1]
		SubChild=DirClass.GetDirectories NeedCheck[1]
		--//--
		for f in 1 to SubChild.count do 
			(
			append FinalPath SubChild[f]
			AppChild=DirClass.GetDirectories SubChild[f]
			--//--
			 if AppChild.count >= 1 then join NeedCheck AppChild
			--//--
			)
		deleteitem NeedCheck 1
		--//--
		)
	sort FinalPath
	FinalPath
	)
--//--
global myfolder=GatherSubFolder "C:\\"
--//--
clearlistener()
--for f in myfolder do print f
print myfolder.count
-->my count :24616
-->reported count :24618
)


Superbe Martin

Really nice

Thank, I put back the maxscript getdirectory since it seam to be faster


(
fn GatherSubFolder Rootfolder =
	(
	TreeStruct=GetDirectories (Rootfolder+"\\*")
	FinalPath=#()
	NeedCheck=#()
	--//--
	if TreeStruct.count != 0 then
		(
		for f in 1 to TreeStruct.count do
			(
			if (GetDirectories (TreeStruct[f]+"\\*")).count > 1 then 
				(
				append NeedCheck TreeStruct[f]
				) 
			else 
				(
				append FinalPath TreeStruct[f]
				)
			)
		)
	--//--
	while NeedCheck.count != 0 do
		(
		append FinalPath NeedCheck[1]
		SubChild=GetDirectories (NeedCheck[1]+"\\*")
		--//--
		for f in 1 to SubChild.count do 
			(
			append FinalPath SubChild[f]
			AppChild=GetDirectories (SubChild[f]+"\\*")
			--//--
			 if AppChild.count >= 1 then join NeedCheck AppChild
			)
		deleteitem NeedCheck 1
		--//--
		)
	sort FinalPath
	FinalPath
	)
--//--
global myfolder=GatherSubFolder "C:\\"
--//--
clearlistener()
--for f in myfolder do print f
print myfolder.count
-->my count :24616
-->reported count :24618
)


35% faster!!!

i made this script.

I ll add later some more stuff

hehe , I like this script , very usefull

I like the script,But there is no directory of memory function, if there is all the better

Page 2 / 4