Easy A
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 file size help

View previous topic View next topic Go down 
AuthorMessage
Database
Member
Member
Database

Posts : 318
Join date : 2012-03-04

file size help Empty
PostSubject: file size help   file size help EmptyFri Jul 27, 2012 10:56 pm

how would i go about going into a directory....and getting the size of all the files combined in that directory...

File.size("/blah/dir") doesnt accept the use of the wildcard *

and using . just makes it list the size of the DIRECTORY not the files it contains

any ideas?

thanks
Back to top Go down
Database
Member
Member
Database

Posts : 318
Join date : 2012-03-04

file size help Empty
PostSubject: Re: file size help   file size help EmptyFri Jul 27, 2012 10:56 pm

Yeah, I don't think there's a way to get File.size to do all the work.

I'd use

Code:

Dir.new('/blah/dir').inject(0) { |sum, file| sum += File.size(file) }
Back to top Go down
 

file size help

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» restrict file upload size
» C: Read from file and write to file
» optimal MB of size per minute of .swf movie
» Seeing If File Is Audio
» Please help - Dom Parsing XML file to HTML?

Permissions in this forum:You cannot reply to topics in this forum
Easy A :: file size help Edit-trash Useless :: Trash-