#22675 - 2002-06-06 02:15 AM
Dir () did not work well for me !!
|
Anonymous
Anonymous
Unregistered
|
Hi , I am using Dir () to calculate the number of files in a folder and some subdirectories under that tree .
code:
$Count = 0 $Filename = Dir( "C:\BigTree\*.*") While $Filename <> "" and @ERROR = 0 $Count = $Count + 1 ? $Filename $Filename = Dir() Loop ? $Count ; print the total files
_________________________________ The result just gave me all files at C:\BigTree folder, but not subdirectories's files under BigTree .
Any help would be appreciated Don
|
|
Top
|
|
|
|
#22676 - 2002-06-06 02:18 AM
Re: Dir () did not work well for me !!
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Hi Donald, thats by design
|
|
Top
|
|
|
|
#22679 - 2002-06-06 02:38 AM
Re: Dir () did not work well for me !!
|
Anonymous
Anonymous
Unregistered
|
No, actually I am doing more than just calculate the number of files. Low tech won't help me on this. By the way, the main thing that I 'm finding the directory file size? Any ideas ? Thanks Don
|
|
Top
|
|
|
|
#22683 - 2002-06-06 03:24 AM
Re: Dir () did not work well for me !!
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
But now Donald can shell-out to DOS, comfortable in the knowledge that "the other way" really, really sucks
p.s. Les, thanks for NOT timing it
ps.ps - how about the FileSystemObject - any methods there for grabbing a quick dir size ?
-Shawn [ 06 June 2002, 03:28: Message edited by: Shawn ]
|
|
Top
|
|
|
|
#22687 - 2002-06-06 04:37 AM
Re: Dir () did not work well for me !!
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Just to see what I could provide in Perl, I threw together a little recursing script. Here are the results:
c:\data\scripts>recurse2.pl c:\winnt Elapsed time: 15 seconds Files: 10824, Bytes: 1287020642
dir c:\winnt /s took 50 seconds. Total Files Listed: 10726 File(s) 1,284,268,060 bytes 857 Dir(s) 16,329,506,816 bytes free
I am still checking/debugging but if anyone is interested, I'll compile it and post it on my web site.
c:\data\scripts>recurse2.pl c:\winnt c:\data Elapsed time: 19 seconds Files: 13546, Bytes: 2004357973
--------------------------------------------- checking C:\data on my computer:
DOS DIR Total Files Listed: 2720 File(s) 717,319,707 bytes
c:\data\scripts>recurse2.pl c:\data Elapsed time: 5 seconds
Not quite sure where the 2 additional files came from. But on another directory the program and DOS Dir match. Files: 2722, Bytes: 717336963 [ 06 June 2002, 04:45: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#22688 - 2002-06-06 06:43 AM
Re: Dir () did not work well for me !!
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I know it's not Kix but in case the Kix efforts for this task don't pan out...
I have posted DirSize.exe that is rather quick and returns the actual number of directories, files, and total bytes used.
DOS's "Dir" command counts all the "." and ".." directories when it counts the number of directories on my W2K Pro SP2 computer. If anyone needs something slightly different let me know. [ 06 June 2002, 06:44: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#22690 - 2002-06-06 03:40 PM
Re: Dir () did not work well for me !!
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
DOH!!
Sometimes life is too simple. At least my little Perl exercise agrees with the DirUse.exe output. FWIW.
|
|
Top
|
|
|
|
#22691 - 2002-06-06 06:18 PM
Re: Dir () did not work well for me !!
|
Anonymous
Anonymous
Unregistered
|
Hello, Many thanks to all of yours help, I am gona to try them all to see which is best fit into my environment. I thought about Dos Dir too, but I still need to take that result into an Kix's $variable and continue to compare other condition. Any advice on that as well ?
Like: $Dirsize = DOS Dir size .. if I jump to dos shell .
Again, thank you all . Don
|
|
Top
|
|
|
|
#22694 - 2002-06-06 08:36 PM
Re: Dir () did not work well for me !!
|
Anonymous
Anonymous
Unregistered
|
Hello Les and Shawn, First of all, I would like to say thanks to all of your supports and I felt bad that did not given a full discription in details to you all. Actually, it is a technically problem in our NT environment. Lately, we found that there have changed on our current NT image and it causes from C:\WINNT\Profiles\Default Users 's profile.
Our current image of this profile aproximated 1.2 MB. After a year of full deployment, we have reported that this were changed on number of systems and it caused an issue of SMS deployment in some cases. My project is to target these systems and resolve the caused. I am targeting on these systems in comparison of original image and dump to a log file on it local system then I will review it later or at least I can deploy SMS to other system. A dump.log file on local which are the files that different from the original image.
Again, thanks you all. Don
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 483 anonymous users online.
|
|
|