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

Igor Birman igor_birman at yahoo.com
Thu Feb 12 09:22:55 EST 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://calypso.tux.org/pipermail/novalug/attachments/20090212/3b9235a4/attachment.html 


More information about the Novalug mailing list