Permalink
Browse files

Switching to a safer delete.

  • Loading branch information...
1 parent 72bc37a commit 7e5751a1602b159979ae26bdbd0765b678af7bcb @JEG2 committed Nov 4, 2010
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/technoweenie/attachment_fu/backends/ssh_backend.rb
@@ -136,7 +136,10 @@ def filename=(value)
def destroy_file
start_ssh do |ssh|
ssh.exec!("rm #{e full_filename}")
- ssh.exec!("rm -r #{e File.dirname(File.dirname(full_filename))}")
+ dir = File.dirname(full_filename)
+ ssh.exec!("find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\;")
+ dir = File.dirname(dir)
+ ssh.exec!("find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\;")
end
end

0 comments on commit 7e5751a

Please sign in to comment.