[ale] mv files with tar??

Charles Shapiro charles.shapiro at nubridges.com
Wed Oct 30 15:09:02 EST 2002


I've always thought that having extra cats cross your path was bad luck.
As written here, the extract-side tar will try to extract from the file
"1"; you probly meant "tar -x -b 1 -f -" there. I like seeing the files
scroll by, so I also add a "-v" to the extract side. The "&&" is a nice
touch; it means that the 2nd tar(1) will execute iff the 'cd' works
(e.g. the directory argument exists).

IIRC there are some special crunchy parts in HP-[S]UX to this command
string. Possibly an extra argument or two to the extract-side tar(1) to
make sure you get the source ownership instead of yourself ? In Linux's
tar it's "--same-owner". It might be worth a visit to the man page to
double check this. I remember that eventually I stuck it in a shell
alias to keep from having to memorize the HP quirks.

-- CHS

On Wed, 2002-10-30 at 14:53, Armsby John-G16665 wrote:
> Any issue with this:  
> 
>  tar cf - . | cat | (cd /u02/home/armsjoh/srcTest_dir && tar xbf 1 -)
> 
> I found it on the internet.  Seems to keep permissions and timstamps....
> 
> OK by all?
> 
> -----Original Message-----
> From: Charles Shapiro [mailto:charles.shapiro at nubridges.com]
> Sent: Wednesday, October 30, 2002 2:42 PM
> To: Armsby John-G16665
> Cc: ale at ale.org
> Subject: Re: [ale] mv files with tar??
> 
> 
> That would be the famous 'flying tar':
> 
> cd fromdir ; tar -cf - ./* | (cd todir; tar -xvf -)
> 
> -- CHS
> On Wed, 2002-10-30 at 14:34, Armsby John-G16665 wrote:
> > I need to mv a large number of files to a designated subdirectory, with timestamps, permisisons, etc.INTACtT.  
> > 
> > The command:  mv /mydirectory/* . where I am presetnly at the designated subdirectory yields a "too many args" error.  I am on HPUX.
> > 
> > I know there is a command string using tar and pipe(|) to copy the files keeping the timestamps, permisions, etc intact in the new designated directory.
> > 
> > I don't recall the command.  anyone got it??  It is pretty commonly used.
> > 
> > John
> > 
> > 
> > 
> > 
> > ---
> > This message has been sent through the ALE general discussion list.
> > See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
> > sent to listmaster at ale dot org.
> > 
> 
> 
> ---
> This message has been sent through the ALE general discussion list.
> See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
> sent to listmaster at ale dot org.


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list