Tuesday, January 5, 2010

[Rails] Re: Delete multiple files in RAILS_ROOT/tmp/pdfs/

That worked great. Here's how my code looks now.

Thanks,

Frank

--------------
@user_files_mask =
File.join("#{RAILS_ROOT}/tmp/pdfs/#{User.find(current_account.id).full_name}*")

@user_files = Dir.glob(@user_files_mask)

@user_files.each do |file_location|
File.delete(file_location)
end
--------------


pharrington wrote:
> Dir[mask] # http://ruby-doc.org/core/classes/Dir.html#M002323
> File.delete *files_matched_by_glob

--
Posted via http://www.ruby-forum.com/.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate