[ale] cp but maintaining path?

Jeff Lightner jlightner at water.com
Fri Mar 14 10:07:33 EDT 2008


The "-p" option of cp and rsync also preserves permissions etc...

-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of danverde
Sent: Thursday, March 13, 2008 6:31 PM
To: ale at ale.org
Subject: Re: [ale] cp but maintaining path?


Tar is really what you want to use.  It will maintain original file 
dates/times and permissions where copy wont necessarily.

tar -cf - <src dir> | tar  -tf -  -C <dest dir>


Dan



On Wednesday 12 March 2008 03:39:22 pm Greg Freemyer wrote:
> I forgot about rsync.  That would been a great choice I suspect.
>
> I have it working the tar way. (My off the cuff effort was pretty
> close except I forgot that dir2 was a variable in my script.  ie. I'm
> trying to split up a huge directory tree into a bunch of smaller ones.
>
> Now it is running, I'll just let it run.
>
> Greg
>
> On Wed, Mar 12, 2008 at 3:23 PM, Björn Gustafsson <bg-ale at bjorng.net> wrote:
> > Kinda depends on what $relative-path is like, but I'd usually use
> >  rsync for that kind of operation.
> >
> >  On Wed, Mar 12, 2008 at 3:12 PM, Greg Freemyer <greg.freemyer at gmail.com> 
wrote:
> >  > All,
> >  >
> >  >  I'm trying to do something a little strange.
> >  >
> >  >  I am working on a shell script that in the middle of it needs to copy
> >  >  files (individually) from dir1 to dir2.
> >  >
> >  >  The trouble is that there is directory structure below dir1 that I
> >  >  want to recreate in dir2.
> >  >
> >  >  Any ideas?
> >  >
> >  >  Now that I'm thinking, maybe:
> >  >
> >  >  cd dir1
> >  >  tar -cf - $relative-path | (cd dir2; tar -xf -)
> >  >  cd dir2
> >  >
> >  >  I'll go experiment, but if anyone knows a better way or the specific
> >  >  args for this way, I would appreciate it.
> >  >
> >  >  Thanks
> >  >  Greg
> >  >  --
> >  >  Greg Freemyer
> >  >  Litigation Triage Solutions Specialist
> >  >  http://www.linkedin.com/in/gregfreemyer
> >  >  First 99 Days Litigation White Paper -
> >  > 
> >  > http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.
> >  >pdf
> >  >
> >  >  The Norcross Group
> >  >  The Intersection of Evidence & Technology
> >  >  http://www.norcrossgroup.com
> >
> >  --
> >  Björn Gustafsson
> >
> >  _______________________________________________
> >  Ale mailing list
> >  Ale at ale.org
> >  http://mail.ale.org/mailman/listinfo/ale



_______________________________________________
Ale mailing list
Ale at ale.org
http://mail.ale.org/mailman/listinfo/ale
----------------------------------
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
----------------------------------



More information about the Ale mailing list