Jump to content

.SH script problems

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
Share on other sites

Link to post
Share on other sites

And what exactly is the problem?

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

 

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

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Dutch_Master said:

And what exactly is the problem?

It's supposed to copy just /minecraftworld/, but it copies every directory beforehand as well (/home/TheGermenEngie/minecraftserver/minecraftworld/.

Link to comment
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
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

×