Skip to content
Browse files

If the remote dir doesn't exist, it is created

  • Loading branch information...
1 parent 78bd155 commit 54a819410b568fb455e99e35cdd37cbdb291161e @terenced committed Apr 12, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 ftp_sync.rb
View
8 ftp_sync.rb
@@ -131,7 +131,13 @@ def upload_folder(dir, ftp)
def sync_folder(local_dir, remote_dir, ftp)
Dir.chdir local_dir
- ftp.chdir remote_dir
+ begin
+ ftp.chdir remote_dir
+ rescue
+ # if the remote dir doesn't exist, we create it
+ ftp.mkdir remote_dir
+ ftp.chdir remote_dir
+ end
put_title "process folder: #{Dir.pwd}"

0 comments on commit 54a8194

Please sign in to comment.
Something went wrong with that request. Please try again.