Preserved Topic: Quick little question on PHP (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Under, The, Sea |
posted 10-25-2001 18:53
I've got this small code snippet that I got off the web, and was wondering if I could implement something that could find the size of a folder (not including subfolders), and print it out on screen. I found another little snippet on the PHP web page: |
Nervous Wreck (II) Inmate From: Under, The, Sea |
posted 10-25-2001 19:23
Nope, it actually doesn't work.. |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 10-25-2001 22:21
This will do what you want: |
Nervous Wreck (II) Inmate From: Under, The, Sea |
posted 10-26-2001 01:50
I'm not sure I'm doing this right.. What would the parameter $dir look like? If it's a handle to the path, would it mean I would have to do a call to opendir()? |
Nervous Wreck (II) Inmate From: Under, The, Sea |
posted 10-26-2001 01:52
Oops, I meant a call to dirname()? |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 10-26-2001 01:54
You would need to set it in your script. |
Nervous Wreck (II) Inmate From: Under, The, Sea |
posted 10-26-2001 02:17
Hmm, I've got it working (mostly), except it only checks the first file's size and prints it out :P It seems like it's breaking out of the while() a bit too fast.. |
Nervous Wreck (II) Inmate From: Under, The, Sea |
posted 10-26-2001 02:54
OK, I think this is what's going on.. It's somehow reading "." as a file, and.. it seems to forget the rest of the files.. Any clues? |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 10-26-2001 07:12
I have tested my function on Windows and Linux and it works without any problems. And as in my example simply call it like this: |