I have written such a shell script which uploads files over ftp to my deployment server . This script working perfectly if you want full-deployment i.e entire project in one go . but problem is when i change specific file on local machine and now i want it to overwrite existing same file on server using ftp it's not overwriting.
MKDIR=`for directory in $FOLDERS; do echo "mkd \"${directory}\""; done`
DELETE=`for file in $DFILES; do echo "delete \"${file}\""; done`
ATTACH=`for file in $FILES; do echo "put \"${file}\""; done`
IFS=$ORIGIFS
# Send updates to server
ftp -nv <<EOF
open $FTPHOST
user $FTPUSER $FTPPASS
binary
cd $FTPDIR
$MKDIR
$ATTACH
quit
EOF
Where: FOLDERS:contains directories to create, DELETE is string which has deleted files list , ATTACH has list of files that has been modified and needs to be overwritten on server that are exist.
After that when i run it second time after modification in existing files :
local: ./testproject/trunk/test.php ./svnupdate.txt remote: ./testproject/trunk/test.php ./svnupdate.txt
local: ./testproject/trunk/test.php ./svnupdate.txt: No such file or directory
I found my answer .
Problem statement in my script :
ATTACH=`for file in $FILES; do echo "put \"${file}\""; done`
where i create list of files to upload.But this code concatenate each file names as told by @Jdamian. @Jdamian thanks for point out my mistake.
Solution:
ATTACH=`for file in $FILES
do
echo "put $file"
done`