Description: ######################## INFORMATION ################################ File_2_FTP v.1.3 nautilus script (c) 2008 | Sasha Khamkov license - Free to use but not to sell or gain profit by any other possible way. Questions and such - - www.sanusart.com --------------------------------------------------------------------- Dependencies: - zenity (present by default in most cases) - Pure-FTPd (present by default in most cases) --------------------------------------------------------------------- Description: - This script makes a use of built-in 'Pure-FTPd' to upload selected file to FTP server. This is most usefull if you need to share something and resend the URL to the file. [P.S.] - There are 2 files - "File_2_FTP" stores the USERNAME & PASSWORD inside - it is somewhat unsecure. "File_2_FTP_secure" asks for USERNAME & PASSWORD at the time of upload - no sesetive data is exposed. --------------------------------------------------------------------- Usage: [1] - Edit settings section bellow [2] - Put this file to '~/.gnome2/nautilus-scripts/' directory --------------------------------------------------------------------- Access: [1] - right mouse button on file to upload. [2] - Go to scripts => File_2_ftp [3] - (only 'File_2_FTP_secure')You'll be asked to provide username & password, it was made to avoid storing sensitive data inside the script. [4] - Log will show-up upon successful/failed upload to inform about the session and details. [5] - Full URL to the uploaded file will pop-up only if $URL variable in settings was specified correctly. --------------------------------------------------------------------- I am NOT responsible for any data loss caused by use of this script ---------------------------------------------------------------------Last changelog:
21/05/2008 ---------- - Added secure version of the script - ask for USER & PASS instead of store. - Outputs URL of uploaded file. - Minor improvements.
Firstly thanks for the script!
I did some small modifications to make this script work on my Ubuntu pc. I had to replace $file with $@ as $file didn't return anything. I've also added "" to the local dir name to allow for SPACEs in the directory name.
Lastly I've changed the feedback so that the URL is copied to the clipboard rather than being shown in a dialog box.
You might need to download xclip (sudo apt-get install xclip) for the script to work.
If problems with the original script, you might try replacing the last part of the scrip with this:
######################## END OF SETTINGS ##############################
# IMPORTANT! #
# Do not edit bellow this line unless you know what are you doing !!! #
# see 'man ftp' for more options. #
#---------------------------------------------------------------------#
local_dir=$PWD
file=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS`
# For passive mode add 'p' to the 'ftp' flags (e.g. -pnivg).
ftp -pnivg $host $port > $logfile <<END_SCRIPT
quote binary
quote USER $username
quote PASS $userpass
cd $remote_dir
lcd "" + $local_dir + ""
put $@
bye
END_SCRIPT
# echo `zenity --text-info --filename="$logfile" --title="File_2_FTP - LOG"`
# echo `zenity --info --text="The URL is: http://$URL/$remote_dir/$@"`
echo "http://$URL/$remote_dir/$@"|/usr/X11R6/bin/xclip -selection "clipboard"
exit 0
Thank you for the fix.
Just wanted to note that spaces in web related file names often cause problems in some browsers + overwriting the clipboards content will not be welcome among all users, as sometimes, uploading takes longer time and the user might do other clipboard related stuff at the moment.
Thanks.
Ratings & Comments
2 Comments
Firstly thanks for the script! I did some small modifications to make this script work on my Ubuntu pc. I had to replace $file with $@ as $file didn't return anything. I've also added "" to the local dir name to allow for SPACEs in the directory name. Lastly I've changed the feedback so that the URL is copied to the clipboard rather than being shown in a dialog box. You might need to download xclip (sudo apt-get install xclip) for the script to work. If problems with the original script, you might try replacing the last part of the scrip with this: ######################## END OF SETTINGS ############################## # IMPORTANT! # # Do not edit bellow this line unless you know what are you doing !!! # # see 'man ftp' for more options. # #---------------------------------------------------------------------# local_dir=$PWD file=`basename $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS` # For passive mode add 'p' to the 'ftp' flags (e.g. -pnivg). ftp -pnivg $host $port > $logfile <<END_SCRIPT quote binary quote USER $username quote PASS $userpass cd $remote_dir lcd "" + $local_dir + "" put $@ bye END_SCRIPT # echo `zenity --text-info --filename="$logfile" --title="File_2_FTP - LOG"` # echo `zenity --info --text="The URL is: http://$URL/$remote_dir/$@"` echo "http://$URL/$remote_dir/$@"|/usr/X11R6/bin/xclip -selection "clipboard" exit 0
Thank you for the fix. Just wanted to note that spaces in web related file names often cause problems in some browsers + overwriting the clipboards content will not be welcome among all users, as sometimes, uploading takes longer time and the user might do other clipboard related stuff at the moment. Thanks.