Powered By

Powered by Blogger

Tampilkan postingan dengan label scp. Tampilkan semua postingan
Tampilkan postingan dengan label scp. Tampilkan semua postingan

Sabtu, 23 Januari 2010

Nautilus Script To Quickly Copy Files To Your iPhone [Ubuntu w/ Gnome]

Thanks to StoneCut, here is yet another iPhone tip for Web Upd8 readers. After StoneCut's absolutely amazing post on Mounting Your iPhone On A Fresh Ubuntu Karmic Koala Installation (The Complete Guide), today he sent us another great tip: a Nautilus script for SCP transfers that he uses to quickly copy files to his iPhone and might be very useful for some Web Upd8 readers.

Here is the script:


#!/bin/bash
user='root'
machine='192.168.1.121'
defaultDir='/private/var/mobile/Downloads'

if [ -z $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS ]; then
zenity --timeout 3 --title "Select files" --info --text "No files have been selected"
exit
fi

destination=`zenity --title "Target destination" --entry --text "Enter target destination:" --entry-text "$defaultDir"`

for f in $*
do
scp $f $user@$machine:"$destination"
if [ $? -eq 0 ]; then
zenity --timeout 3 --title "File transfer finished" --info --text "$f sent to $destinationi\n\nWindow will autoclose in 3 seconds."
else
zenity --timeout 3 --title "File transfer failed" --info --text "*** FAILED TO SEND $f ***\n\nWindow will autoclose in 3 seconds"
fi
done


Before using the script, make sure you have zenity installed:
sudo apt-get install zenity


Thank you once again, StoneCut!