2
# Current date
now=`date +%Y-%m-%d:%H:%M`

# Compress folder
tar czf "$now.tar.gz" dump/

does not work. No tar is created. But

tar czf someName.tar.gz dump/

works fine. Can someone point out the problem? It seems that

tar czf "$now.tar.gz" dump/

is not accepted as filename. Any ideas?

1
  • Does the --force-local flag help? Commented Dec 31, 2014 at 18:44

1 Answer 1

2

Found the problem:

If the archive file name includes a colon (‘:’), then it is assumed to be a file on another machine[...]

which lays here

now=`date +%Y-%m-%d:%H:%M`

I replaced the : with - and it works fine. More info here: http://www.gnu.org/software/tar/manual/html_section/tar_46.html#file

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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