Tuesday, January 5, 2010

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

Cleaned up code:
------------
@user_files =
Dir.glob(File.join("#{RAILS_ROOT}/tmp/pdfs/#{User.find(current_account.id).full_name}*"))

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

Frank Kany wrote:
> --------------
> @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
> --------------


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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate