help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Tar on Windows XP


From: Gadrin
Subject: Re: GNU Tar on Windows XP
Date: Sun, 2 Mar 2008 06:58:32 -0800

Hi, thanks for responding.

I was going off of
http://forums12.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1204469251779+28353475&threadId=1178036

The difference being the "." (dot) to match everything. However in gnu tar, I'm able to use a single directory when I type in the
command line as I mentioned

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

J:\Temp Folders\wbtTemp>tar -c -f Top.tar Top

J:\Temp Folders\wbtTemp>tar -t -v -f Top.tar
drwsrwsrwx user/group        0 2008-02-29 21:16 Top/
drwsrwsrwx user/group        0 2008-02-29 21:16 Top/Middle/
drwsrwsrwx user/group        0 2008-02-29 21:16 Top/Middle/Bottom/

J:\Temp Folders\wbtTemp>

It creates the archive just fine, when I reference only "Top" as the file or input argument.
However the problem is that gnu tar won't take the piped arguments from the find command
to build a similar archive. I want to be able to "do it on the fly" meaning I don't have to build
an empty dir structure then build the archive.

In the meantime I've found a alternative method, which isn't so bad...

(Just substitue Writing for Top  as a folder in the following)

J:\Temp Folders\wbtTemp>xcopy c:\writing "J:\Temp Folders\wbtTemp\writing\" /t /e  :<-- creates an empty/temporary structure
J:\Temp Folders\wbtTemp>tar -c -f Writing.tar writing      '<-- creates an archive of the dir structure
J:\Temp Folders\wbtTemp>tar -t -v -f Writing.tar             ;<--- shows all folders
J:\Temp Folders\wbtTemp>rd /q /s writing                     ;<--- removes the blank/temporary structure.

I was hoping there was a way to pipe the folder names to tar, but so far no joy.

Jay


On Sat, Mar 1, 2008 at 7:23 PM, Bob Proulx <address@hidden> wrote:
Gadrin wrote:
> if I use
> J:\Temp Folders\wbtTemp>tar -c -f Test.tar | find Top ! -type f
> tar: Cowardly refusing to create an empty archive
> Try `tar --help' for more information.
> Top
> Top\Middle
> Top\Middle\Bottom
>
> tar gives up and won't create the archive. Am I doing something
> wrong ? Just not possible ?

Yes, you are doing something silly.  :-)  The -c option creates an
archive.  You are telling tar with 'tar -c -f Test.tar' to create a
tar archive Test.tar.  But you didn't give it any file arguments on
the command line.

And you are piping that into find which doesn't make sense to me
either.  The find comand will find files and take an action such as
outputing the name or other things but doesn't make sense receiving
whatever input was going to go into it there.

You probably wanted to do something like this:

 tar -c -f Test.tar `find Top -type d`

Except that requires a unix like command shell and your message showed
you using the MS command.com and this won't work there.  It would work
in bash but not in command.com.  You might be able to use bash for the
command line like this.  I have not tried it.

 bash -c "tar -c -f Test.tar `find Top -type d`"

Bob



--
Thanks, Gadrin
reply via email to

[Prev in Thread] Current Thread [Next in Thread]