title: FTP upload failed
body: <p>I have a bash script that backs up my iOS files over FTP and I'm getting a few problems, I'm just wondering if anyone could help me out?</p>
  
  <p>Here's my script:</p>
  
  <pre><code>  #!/bin/bash
    mkdir zipfolder
    cp /var/mobile/Library/SMS/sms.db /var/root/zipfolder/
    cp /var/mobile/Library/Notes/notes.sqlite /var/root/zipfolder/
    cp /var/mobile/Library/Safari/Bookmarks.db /var/root/zipfolder/
    cp /var/mobile/Library/Safari/History.plist /var/root/zipfolder/
    cd var/root
    zip -r zippyy.zip zipfolder
  
    HOST=HOSTNAME
    USER=USERNAME
    PASS=PASSWORD
  
    ftp -inv $HOST &lt;&lt; EOF
    user $USER $PASS
    cd sms
    LIST=$(ls | grep zippyy*.zip)
  
    FILECOUNT=0
    for FILE in $LIST
    do
        if [ -f $FILE ];
        then
            FILECOUNT+=1
    done
    FILECOUNT+=1
    NEXTDB="zippyy$FILECOUNT.db"
    mv zippyy.zip $NEXTDB
  
    ftp -inv $HOST &lt;&lt; EOF    
    put $NEXTDB
    bye
    EOF
  
    rm -f zippyy.zip
    rmdir zipfolder
  </code></pre>
  
  <p>I get the following errors:</p>
  
  <pre><code>  ?Invalid command
    ?Invalid command
    We only support non-print format, sorry.
    ?Invalid command
    ?Invalid command
    ?Invalid command
    ?Invalid command
    ?Invalid command
    ?Invalid command
    ?Invalid command
    ?Invalid command
    ?Invalid command
    (local-file) (remote-file)
  
    rmdir: failed to remove 'zipfolder': Not a directory
  </code></pre>