Jump to content

Hi all -

I have a little .sh script that I can use to remotely zip and copy over my minecraft server world to a virtual machine. Minecraft worlds exist as a directory, not a file. I do this every night as a backup. However recently when I log in to the virtual machine and unzip the backed up world (which exists as a directory not a file) it unzips into mutiple directories which include /home/, /TheGermanEngie/, /minecraftserver/, and then /minecraftworld/. Instead of backing up just the /minecraftworld/ it zips all the directories before hand. How can I make it so it only zips the /minecraftworld/ and not the other directories?

Here is the backup script.

zip -r BTTPnightly.zip /home/thegermanengie/minecraftserver/world && scp /home/thegermanengie/minecraftserver/BTTPnightly.zip bckup@192.168.1.48:/home/bckup/backup

 

Link to comment
https://linustechtips.com/topic/1152967-sh-script-problems/
Share on other sites

Link to post
Share on other sites

That's because of the -r flag in your command. Zip has a ton of flags and you'd really need to carefully read what flag does what so you can choose the correct ones. In your case (given you're essentially making a daily backup of sorts), consider the -f flag.

 

Here's the man page for zip:

https://linux.die.net/man/1/zip

"You don't need eyes to see, you need vision"

 

(Faithless, 'Reverence' from the 1996 Reverence album)

Link to comment
https://linustechtips.com/topic/1152967-sh-script-problems/#findComment-13276747
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×