Skip to content

Instantly share code, notes, and snippets.

@mo9a7i
Created April 12, 2023 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mo9a7i/1ad6f6485ee7a490da8db615ff527e4f to your computer and use it in GitHub Desktop.
Save mo9a7i/1ad6f6485ee7a490da8db615ff527e4f to your computer and use it in GitHub Desktop.
A script to move files from server to server using ftp
#!/bin/sh
##########################################
# By: Mo9a7i (livehostsupport@gmail.com #
##########################################
temp="/tmp/$(basename $0).$$" ; trap "/bin/rm -f $temp" 0
remote='176.31.46.12'
dire='public_html/hard'
ftpu='backup'
ftpp=''
transtype='binary'
echo "user $ftpu $ftpp" > $temp
echo "cd $dire" >> $temp
echo "$transtype" >> $temp
for x in $*
do
f1=$(basename $x)
echo "put $x $f1" >>$temp
done
echo "quit" >> $temp
ftp -n -v $remote < $temp
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment