This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Space in Dir Name with shell script and tar


I am trying to make a shell script to do automatic bckups with tar.

My problem is that tar stumbles on the spaces in the dir names if they are
in a variable.

Probiably best shown by example

The dir I want to back up is 
g:/Mark I+/Experimental Data/

I if do this in the script
tar -czvpf $NAME_OF_BACKUP.tgz /cygdrive/g/Mark' 'I+/Experimental' 'Data/*
it works fine but if I do this

DIRECTORY_TO_BACKUP="/cygdrive/g/Mark' 'I+/Experimental' 'Data"
tar -czvpf $NAME_OF_BACKUP.tgz $DIRECTORY_TO_BACKUP/*

I get 
tar: Removing leading `/' from member names
tar: /cygdrive/g/Mark': Cannot stat: No such file or directory
tar: 'I+/Experimental': Cannot stat: No such file or directory
tar: 'Data/*: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors

What am I doing wrong?
-- 
View this message in context: http://www.nabble.com/Space-in-Dir-Name-with-shell-script-and-tar-tf3031755.html#a8423703
Sent from the Cygwin Users mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]