Helpful Information
Home
Categories
Contact us
Category: Ruby & Ruby On Rails
file size
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
Yeah, I don't think there's a way to get File.size to do all the work.
I'd use
Dir.new('/blah/dir').inject(0) { |sum, file| sum += File.size(file) }
privacy (GDPR)