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

Richard Burkhart richard at khanfusion.net
Fri Oct 19 13:25:58 PDT 2007


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

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

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.


More information about the vox-tech mailing list