delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/06/03/17:38:04

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Thu, 3 Jun 2004 17:37:18 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Will Senn <will_senn AT comcast DOT net>
cc: cygwin AT cygwin DOT com
Subject: Re: Problem with spaces embedded in filenames
In-Reply-To: <40BF9224.7090303@comcast.net>
Message-ID: <Pine.GSO.4.58.0406031730430.24345@slinky.cs.nyu.edu>
References: <40BF9224 DOT 7090303 AT comcast DOT net>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Thu, 3 Jun 2004, Will Senn wrote:

> Hi,
>
> I am doing backups with tar on XP. I thought that I could touch a file
> when I did a full backup and then use find with newer to only back up
> files that are newer than the touched file:
>
> ~    touch /cygdrive/i/backups/full_backup
> ~    find /cygdrive/d/sandbox -newer /cygdrive/i/backups/full_backup !
> ~    -type d -print | sed -e "s/\ /\\\\ /g"`
>
>
> this command produces the following list of files:
>
> ~    /cygdrive/d/sandbox/another\ test.txt
> ~    /cygdrive/d/sandbox/test.txt
>
>
> 'another test.txt' is a file with an embedded space (I figured I
> needed to escape the space, hence the sed)
>
> The problem is this, when I use the output of this command as the
> input of another it complains. ie.
>
> ~    $ ls -l `find /cygdrive/d/sandbox -newer
> ~    /cygdrive/i/backups/_sandbox.full ! -type d -print | sed -e "s/\
> ~    /\\\\ /g"`
>
> ~    ls: /cygdrive/d/sandbox/another: No such file or directory
> ~    -rwx------+   1 wsenn    None            0 Jun  3 14:45 /cygdrive/d/sandbox/test.txt
> ~    -rw-r--r--    1 wsenn    None           69 Jun  3 15:26 test.txt
>
> Any help would be appreciated.

That's what xargs was invented for.  Try

find /cygdrive/d/sandbox -newer /cygdrive/i/backups/_sandbox.full ! -type d -print0 | xargs -0 ls -l

> Here's the tar command I planned on using:
>
> ~    tar czf /cygdrive/i/${TODAY}_I_sandbox.tgz `find
> ~    /cygdrive/d/sandbox -newer /cygdrive/i/backups/full_backup ! -type
> ~    d -print | sed -e s/\ /\\\\\ /g`
>
> Later,
> Will

Here you can use something like

find /cygdrive/d/sandbox -newer /cygdrive/i/backups/_sandbox.full ! -type d -print0 | xargs -0 tar czf /cygdrive/i/${TODAY}_I_sandbox.tgz

or even

find /cygdrive/d/sandbox -newer /cygdrive/i/backups/_sandbox.full ! -type d -print0 | tar -T- --null -czf /cygdrive/i/${TODAY}_I_sandbox.tgz

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

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