[Novalug] Is there a way to do do a 'cp' like a 'mkdir -p' on a file?

James Ewing Cottrell 3rd JECottrell3 at Comcast.NET
Thu Feb 12 12:18:12 EST 2009


Other ways:

	ls /my/server/username/projects/file.txt | cpio -pdmv .
	tar -C / -cf - my/server/username/projects/file.txt | tar xvf -

But the rsync way is more succinct and less error prone.

JIM

Brandon Saxe wrote:
> Thanks! 
> 
> 
> --- On Thu, 2/12/09, Igor Birman <igor_birman at yahoo.com> wrote:
> 
>> From: Igor Birman <igor_birman at yahoo.com>
>> Subject: Re: [Novalug] Is there a way to do do a 'cp' like a 'mkdir -p' on a file?
>> To: brandon20va at yahoo.com, "novalug mailing list" <novalug at calypso.tux.org>
>> Date: Thursday, February 12, 2009, 9:22 AM
>> How about
>>
>> `rsync -R /my/server/username/projects/file.txt .`
>>
>> Igor
>>
>>
>>
>>
>>
>> ________________________________
>> From: Brandon Saxe <brandon20va at yahoo.com>
>> To: novalug mailing list <novalug at calypso.tux.org>
>> Sent: Thursday, February 12, 2009 8:46:49 AM
>> Subject: [Novalug] Is there a way to do do a 'cp'
>> like a 'mkdir -p' on a file?
>>
>>
>> I am trying to make it so I can copy a single file (or a
>> directory), but basically a single source and create
>> it's entire path wherever I am copying it to.
>>
>> I want to be able to do something like this (assume I'm
>> in /home/user):
>>
>> `cp --some-special-option
>> /my/server/username/projects/file.txt .`
>>
>> and end up with 
>> /home/user/my/server/username/projects/file.txt
>>
>> without having to first create the parent directories, and
>> all in one command line.
>>
>> Is there a way to do this?
>>
>> I'm thinking there might be a way by using tar/untar
>> and running through pipes, but want to know if there is an
>> easier way.
>>
>> What I'm trying to achieve is a super simple way to
>> 'checkout' a file from another location (with paths
>> intact) without using any sort of repository. I want plain
>> filesystems only.
>>
>> Thanks,
>>   Brandon
>> _______________________________________________
>> Novalug mailing list
>> Novalug at calypso.tux.org
>> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug
> _______________________________________________
> Novalug mailing list
> Novalug at calypso.tux.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug
> 
> 
> ------------------------------------------------------------------------
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.0.234 / Virus Database: 270.10.23/1949 - Release Date: 02/11/09 11:13:00
> 




More information about the Novalug mailing list