DarkMantis
DarkMantis

Reputation: 1516

Bash Zip Script

I have written a script which (in theory) should zip all the contents of a folder (including subfolders and what not).

However, when it's ran, it just includes one folder.

Could you please help.

Here is the script:

#!/bin/sh

# pull the svn files
cd /path/to/my/svn/folder
svn update

#Zip (tar gzip) up the folder
zip -r updateZip trunk/*

sleep 1


USERNAME="******"
PASSWORD="******"
SERVER="127.0.0.1"

# local directory to pickup zip file
FILE="updateZip.zip"

# remote server directory to upload backup
BACKUPDIR="my/backup/dir/"

# login to remote server
ftp -n -i $SERVER <<EOF
user $USERNAME $PASSWORD
cd $BACKUPDIR
mput $FILE
quit
EOF

Upvotes: 1

Views: 7499

Answers (2)

djhaskin987
djhaskin987

Reputation: 10057

To zip up a folder and all its contents in a g-zipped tarball, simply enter

tar czf trunk.tar.gz trunk/

That should do it.

Upvotes: 0

Justin Randall
Justin Randall

Reputation: 84

Zip (tar gzip) up the folder

zip -r updateZip trunk/*

If you want a tar.gz, try

$ tar zcvf updateZip.tar.gz trunk/*

Upvotes: 4

Related Questions