so here's the script that i am trying to get it work:
#!/bin/bash
filePath="$1"
fileName="$( basename "$filePath" )"
backupDir="/my/backup/dir/${fileName}-backups/"
dateTime=$( date "+%d.%m.%Y_%H:%M:%S" )
# Check if backup folder exists if not create them
if [ ! -d "$backupDir" ]; then
mkdir "$backupDir"
fi
# Create the Backup in a zip-file
zip -r "${backupDir}${fileName}-${dateTime}.zip" "$filePath"
This error appears:
zip I/O error: Protocol error
zip error: Could not create output file (/my/backup/dir/filename-backups/filename-06.04.2014_18:54:58.zip)
The problem seems to be the "dateTime" variable. Without this variable the script runs faultless.
EDIT: Ok the problem are the double points in the date string:
dateTime=$( date "+%d.%m.%Y_%H:%M:%S" )
If i change it to
dateTime=$( date "+%d.%m.%Y_%H-%M-%S" )
it works for me. Not really nice, but if there no other possibility...