delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/17/20:50:49

X-Spam-Check-By: sourceware.org
Message-ID: <8423703.post@talk.nabble.com>
Date: Wed, 17 Jan 2007 17:50:26 -0800 (PST)
From: Troy <talexander AT veeco DOT com>
To: cygwin AT cygwin DOT com
Subject: Space in Dir Name with shell script and tar
MIME-Version: 1.0
X-Nabble-From: talexander AT veeco DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019