[vox-tech] Copying data from Windows share to Linux server *with* original date stamps and permissions

Ken Bloom kbloom at gmail.com
Sat Oct 20 18:00:44 PDT 2007


On Fri, 19 Oct 2007 13:25:58 -0700
Richard Burkhart <richard at khanfusion.net> wrote:

> Ken Bloom wrote:
> > (cd /src-dir; tar cf - *) | (cd /target-dir; tar xpf -)
> >
> > p is the flag to preserve permissions when extracting.
> >   
> Thanks - that looks like what I'd seen out on the web.  I've tested
> it, and while it's slow, it seems to be copying the files across with
> the proper file dates. (It is changing the user/group settings to the 
> userid/groupid of the shell I'm logged in with -- but my users are
> all members of that group, so this should not be a problem.)

I thought the p option to tar was supposed to do that. This was
(basically) the command I used to migrate my whole system to a new hard
drive, so I know it preserves ownership. It may be that you can only do
that if you're root.

> One additional question; how would I tweak the above statement so
> that I can copy a select handful of directories on the source, and
> have that directory structure show up on the target?   From my dim
> memories of shell scripting I think it would be:
>    ( for loop -- list directory M[6-7]0[1-7] into a variable {the 'm' 
> directories are the only ones I'm concerned with})
>    --> (pass variable {w} directory name into the command above--for 
> both the source and target directories). 

/src-dir on the source will correspond to /target-dir on the target. If
you want to get subdirectories, just name those in place of the *, and
you'll get the same subdirectory structure in /target-dir as you named
on the source side.

> Like I said; It's been a while since I've done any shell scripting -
> and then mostly for an ARC intro to scripting class.  Is that logic
> on the right track?  Is there a simpler way to do it?
> 
> Thanks!
> 
> Richard B.
> _______________________________________________
> vox-tech mailing list
> vox-tech at lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech


-- 
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.lugod.org/pipermail/vox-tech/attachments/20071020/2d34e535/signature.pgp


More information about the vox-tech mailing list