0

I try to make a backup script, but when i create a zip with the script, and use cd myzip it sais that it dosnt exitst even when i can see it on the server with FileZilla.

This is my script:

TIME=BACKUPMC-`date +%d-%m-%Y-%H:%M`.zip
DEST="/home/daixhosting/d1"
zip -r $TIME /home/daixhosting/d1

Does someone know what the cause can be?

heemayl
  • 91,753

2 Answers2

1

You have carriage return \r in the file names, as a result you are not being able to parse the files using usual manner.

To remove all the \r characters from the file names run the following command in bash from the directory containing the files :

for file in *; do mv -i "$file" "$(sed 's/\r//g'<<<"$file")"; done

Now all the files should not have \r in them , now you can zip them using usual manner e.g. :

zip -r foo.zip /home/foobar/spam/
heemayl
  • 91,753
0

Try changing the name of the zip file to a file name without the ":".

If that's not the problem, consider that the file could be corrupted. So, you'll try to repair it and maybe save a part of the information. Some way for that is, for example,

zip -F broke.zip --out pleasework.zip

or

zip -FF broke.zip --out pleasework.zip