Creating a tar file for download


#1

Hello,

I have an action on my controller named download which creates a tar
file and then sends the file (via send_file) to the user. Its working
but I will like to delete the file once it is sent. The tar file
should be temporary and only available for download and then deleted
from the server. Any idea on how to do this?
Thanks,

def download
@app = App.find params[:id]
system('cd ‘+$removed_email_address@domain.invalid+’ && tar -cf ‘removed_email_address@domain.invalid+’.tar
')
send_file $global_path+"#{@app.name}/#{@app.name}.tar"
end


#2

Basically I just want to be able to delete the file one it is
download. Any ideas?