From: brabuhr@... Date: 2010-08-11T05:25:25+09:00 Subject: Re: Formatting directory listings On Tue, Aug 10, 2010 at 4:05 PM, simonh wrote: > Thanks Vassilis. I'd prefer to not install anything to accomplish > this. Also, I'd like to slightly to rephrase my aim: > > 1. Start off in 'Movies' directory. > 2. Go into each subdir and get list of movies for that subdir. I've > found how to just get the filename instead of full path: Dir['**/ > *.avi'].collect { |vid| File.basename(vid) } http://ruby-doc.org/core/classes/File.html#M002542 > 3. Store which movies are in each subdir. movie_store = { "directory1" => ["file1", "file2", "file3"], "directory2" => ["file4", "file4", "file6"] } > 4. Output the result. [...]