|
Joined: Feb 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Feb 2003
Posts: 14 |
Hi
is there a way to calculate a folders size in mirc? I have done a script that uses a loop to calculate the size of each file in the folder but mirc will crash if the folder is over 1gb... Maybe there is a dll that does this?
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
alias dirsize {
var %t = 0
.echo -q $findfile($$1-,*,0,var %t = %t + $file($1-).size)
return %t
} Worked for me on a 2gb folder.
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
that code didnt work for me.. tryed on my Unreal Tournament dir.. the answer i got was: 639 .. but the size of that dir is 811 mb .. but the files inside the dir is 639 files, 19 folders
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
I don't know why that would be, it's a very basic script.
Try copying it again (I changed it a bit) and changing the name.
//echo -a $dirsize(c:\windows)
I got it to work on 6.01, 6.02, 6.03 and 6.12.
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
heh.. it count the files.. :P my win dir is 1 gig big.. but your litle script says: 7665 and thats right.. if i wanted to count the files in it
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
Unless $file($1-).size was returning 1 that would never happen.
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
all my files and folders return that.. if i use your code, and cant say why.. maybe it have somthing to do with windows 2k ?.. i didnt edir your code at all, just copyed it and pasted it in to my remote.. allways fun to test all codes that people write in this forums..
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
Works for me collective, just so you don't think you're alone >:P
BTW, to those who don't have it working: you realise it's returning bytes, not kilobytes, megabytes, gigbytes, etc--right?
Last edited by KingTomato; 22/12/03 07:27 PM.
-KingTomato
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
I dont think you can calc this to 1 gig: 7665 <<-- bytes or not
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
just took one post to reply somone that have a diffrent code then this abow? it doesnt work as it should "for me".. and i would like to know if you can solve it in som other way
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Feb 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Feb 2003
Posts: 14 |
that code wont work... i have tried it before.. $findfile with the third parement as 0 will result in mirc showing how many files are in that directory..
this is the script I tried before...
alias sizechecker { set %size.time $ctime set %size.total 0 set %size.file 0 :next set %size.file $calc(%size.file + 1) if ($findfile(d:\,*,%size.file) == $null) { goto end } set %size.total $calc(%size.total + $file($findfile(d:\,*,%size.file)).size) goto next :end //echo ended $asctime($calc($ctime - %size.time),nn - ss) ago //echo sharing $calc($calc($calc($calc(%size.total)/1024)/1024)/1024)/1024) GB }
this works but seems to crash on folders with a lot of files in them..The script shouldnt take a lot of time to exacute either so probebly what I am looking for is a dll...
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
Have you actually tried the code? The reason you gave that it won't work is nonsense since .echo -q stops it echoing anything.
|
|
|
|
Joined: Nov 2003
Posts: 227
Fjord artisan
|
Fjord artisan
Joined: Nov 2003
Posts: 227 |
Though i would just say, I also can't see any reason for the alias not to work, and its about the fastest scripting way to do that, I tested it with a 6.5 GB dir and it ran in just 310 ms, went a little faster chaning the %t = %t + $file($1-).size for inc %t $file($1-).size but not much. (270ms)
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
i edited the code as you did. "inc %t $file($1-).size" and i get the same result.. the map i looking true is my mirc folder.. and the answer i get is: 368, and if i take properties of that map, then it's the files that are 368.. and by the way, i changed echo -q to echo -a
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Feb 2003
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Feb 2003
Posts: 14 |
trust me.. this code doesnt work.. I also want to run it on a 120gb directory so 310 is still to high..
|
|
|
|
Joined: Nov 2003
Posts: 227
Fjord artisan
|
Fjord artisan
Joined: Nov 2003
Posts: 227 |
i changed echo -q to echo -a you edit somebodys code then tell them it does not work? strange, because if you used echo -a and not .echo -q it would just echo the total number of files in the dir and all sub dirs... .echo -q is used when you dont want to display something, he used that so you didnt see the number of files in the dir, though it should still return the total bytes of all files, you will see the total files first via the echo -a. maybe you should use the original code.
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
After reading Hitchiker's last post, I think you must be using it as a /command rather than a $identifier.
The /return is there because it is to be used as a $identifier.
|
|
|
|
|