Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

At the moment I'm using filezilla to deploy new versions of a site to the live server. the trouble is that there are one or two config, bootstrap etc. files which are different for the live site and I have to be careful not to overwrite. Also there are big areas of code that never change (eg I use the zend framework, which is always the same).

I'd like to be able to record a macro to upload the same bunch of files and folders every time, excluding subdirectories and files which shouldn't be overwritten.

Does any ftp client offer this?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

ncftp has support for macros. but i would rather use a real scripting language and then transfer only what has to be transfered. and i would prefer ssh/sftp instead of ftp.

share|improve this answer

I have setup expect scripts to do this very thing. If you are on windows for the client, then you will need to install cygwin with expect. On linux, you just need to make sure the expect interpreter is installed. Here is a sample script that I used to transfer files from a windows box to a linux server using scp. It captures the password, then uses it to call scp multiple times for individual files. You could use sftp and wildcards to send multiple files, or even ftp, but I do not like ftp. Ftp sends passwords in the clear.

#!/usr/bin/expect  --

# Prompt for the password and store it in $PASS
send_user "\n"
send_user "Password? "
stty -echo
expect_user -re "(.*)\n" {set PASS $expect_out(1,string)}
send_user "\n"
stty echo

# Set user name and parameters
# You can remove the above password entry and just set it here.
set user "username"
set server "server.com"
# set PASS "superSecret"
set timeout 30
set destDir "/home/user/www/htdocs/updates/"
set scp "/usr/bin/scp"

set file "/cygdrive/c/Workspace/Release/index.html"
puts "\rSending $file to $server\r"
spawn -noecho $scp $file $user@$server:$destDir
match_max 100000
expect "*?assword:*" 
send -- "$PASS\r"
send -- "\r"
expect eof

set file "/cygdrive/c/Workspace/Release/test.cfg"
puts "\rSending $file to $server\r"
spawn -noecho $scp $file $user@$server:$destDir
match_max 100000
expect "*?assword:*" 
send -- "$PASS\r"
send -- "\r"
expect eof
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.