Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

so here's the script that i am trying to get it work:

fileName="$( basename "$filePath" )"
dateTime=$( date "+%d.%m.%Y_%H:%M:%S" ) 

# Check if backup folder exists if not create them
if [ ! -d "$backupDir" ]; then
  mkdir "$backupDir"

# 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/

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...

share|improve this question
up vote 1 down vote accepted

It's probably because ZIP is dos/windows-centric. In Windows, : is disallowed in filenames since it's used as separator between drive letter and path (C:\).

Unless you really need zip, I recommend using tar with gzip or xz compression instead.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.