Hi guys,
Im pretty new to ruby, and I want to re-write a bash script I wrote to
backup some data on an iphone to a local comp, in ruby.
This is the bash version: http://pastebin.com/m1a34a96
Here is what i have in ruby so far: http://pastebin.com/m1c2282c0
What I basically want to do is have an array of remote directories
downloaded via stfp to a local folder in a loop, or something to this
effect, and I cant seem to figure it out...
Any help is greatly appreciated!!
-Chris
···
--
Posted via http://www.ruby-forum.com/.
Ok so I got a little further with this, but its still not working
perfectly... I think the wait method is screwing things up, because I
only get the contents of the first folder.
#!/usr/bin/env ruby
require 'FileUtils'
require 'net/sftp'
$local_dir = '/iBak' + Time.now.strftime("%m_%d_%y")
$user_name = 'root'
$backup_dirs = ['/Applications',
'/var/root/Library/Customize2',
'/var/mobile/Library/Installer',
'/var/mobile/Media/EBooks',
'/var/preferences'
]
puts "Please enter your iPhones IP address:"
$phone_ip = gets.chomp!
puts "Now your password:"
$root_pass = gets.chomp!
puts "\nPress enter to begin..."
gets
FileUtils.mkdir_p $local_dir
Net::SFTP.start( $phone_ip, $user_name, :password => $root_pass ) do
backup>
dls = $backup_dirs.map { |f| backup.download!( f, $local_dir,
:recursive => true) }
dls.each do |d|
d.wait
end
end
Again, any help would be great!
-Chris
···
--
Posted via http://www.ruby-forum.com/\.