Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8994803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:30:35+00:00 2026-06-15T23:30:35+00:00

I have a bash code to backup my iOS files and send them to

  • 0

I have a bash code to backup my iOS files and send them to my website FTP in the directory: (http://mywebsite.com/sms) but when I run this code, it isn’t .zip’ing the files and leaves the file ‘zippyy.db’ in the root of my website, not in the /sms folder.

I will be running this script from a few devices so when I execute the code, if there is already a file in the FTP called zippyy.zip, it will change it to zippyy1.zip, zippyy2.zip etc..

I would be really grateful for somebody to re-write the script for me. Thank you in advance! Here’s my code:

 #!/bin/bash

 ROOTFOLDER="/var/root"
 ZIPNAME="zipfolder"
 ZIPFOLDER=$ROOTFOLDER/$ZIPNAME
 LIBFOLDER="/var/mobile/Library"
 ZIPFILE="zippyy.zip"

 mkdir -p $ZIPFOLDER
 cp $LIBFOLDER/SMS/sms.db $ZIPFOLDER/
 cp $LIBFOLDER/Notes/notes.sqlite $ZIPFOLDER/
 cp $LIBFOLDER/Safari/Bookmarks.db $ZIPFOLDER/
 cp $LIBFOLDER/Safari/History.plist $ZIPFOLDER/
 cd $ROOTFOLDER
 zip -r $ZIPFILE $ZIPNAME

 HOST=HOSTNAME
 USER=USERNAME
 PASS=PASSWORD

 ftp -inv $HOST << EOF
 user $USER $PASS
 cd sms
 dir . remote_dir.txt
 bye
 EOF

 FILECOUNT=$(grep zippyy remote_dir.txt | wc -l)
 NEXTDB="zippyy${FILECOUNT}.db"
 mv $ZIPFILE $NEXTDB

 ftp -inv $HOST << EOF
 user $USER $PASS
 put $NEXTDB
 bye
 EOF
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:30:35+00:00Added an answer on June 15, 2026 at 11:30 pm

    You mean your archive is corrupt once it’s been ftp’d?

    Its likely your sending the file in default mode on your machine, which must be ASCII mode.

    But first, on you local copy of zip file, issue the test option

    zip -t $ZIPFILE
    

    If that succeeds, then change you ftp here-doc to

    ftp -inv $HOST << EOF
     user $USER $PASS
     binary
     put $NEXTDB
     bye
    EOF
    

    Note the addition of the ftp command binary, which means send file without translations for ASCII.


    It’s highly recommended to issue the following command

     man ftp
    

    And read through it at least once. Granted there are sections of even a good ftp man page that I have failed to find useful! 😉 . Also be aware that there are many ftp clients, with only a semblance of adherence to a common set of options, parameters and sub-commands. Don’t assume that once you get it working at home, that it will work at the office, or at your friends place!

    IHTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a short bash script to get source code's dependency files. #!/bin/sh rule=$(cpp
I have certain critical bash scripts that are invoked by code I don't control,
I have the following code which should put programs startable in Bash. if [
We have a system that has some Bash scripts running besides Java code. Since
I am creating a bash script to backup my files with rsync. Backups all
I have the following bash code, which is copied and pasted from bash cookbook
Suppose I have the following code in bash: #!/bin/bash bad_fruit=( apple banana kiwi )
I currently have an existing code in bash that greps a keyword from a
I have a code snippet, as follows. #!/bin/bash filename=tmp_list_filenames line_index=0 cat $filename | while
I have a bash code like this. while <some_condition> do some_script & done My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.