Hi Mike,
On Sat, 10 May 2014 04:31:31 -0500
Mike Dunaway <[email protected]> wrote:
> Hi Shlomi,
>
> Thanks for the feedback.
>
> My intention with my $files, according to the documentation for
> Archive::Tar is that you're supposed to be able to provide a list of
> files. It is my intention for the user to provide a single file or a
> directory, but it doesn't seem to be working properly.
>
> I've tried running it like so:
>
> $ ./eztar -c git.tar.gz *
>
> And only one file in the working directory seems to be getting added to
> the tarball so I think I may be doing something incorrect. Likewise with
> listing contents of a tarball, only the top most files inside the
> tarball is getting listed when using the -l switch so I think I might be
> doing something wrong there, as well.
This is expected because on the UNIX shell the asterisk ("*") gets
wildcard-expanded into a list of files in the current directory and the are
added to @ARGV one by one. See
https://en.wikipedia.org/wiki/Glob_%28programming%29 . What you probably want
is:
my ($archive, @list_of_files) = @ARGV;
See:
http://altreus.blogspot.com.au/2011/08/lists-and-things-made-of-lists.html
One other note is that doing something like "tar -cavf myarc.tar.gz *" is not
advisable because: 1. If myarc.tar.gz already exists in the directory it may be
clobbered. and - 2. It is to mistake with "tar -cavf *" which will clobber the
first file it finds (and it happened to a co-student of mine at the Technion
who had to redo most of his work).
I try to always do "tar -cavf myarc.tar.gz mydir/". If you're looking for a
packaging interface, see patool:
https://freecode.com/projects/patool
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
List of Portability Libraries - http://shlom.in/port-libs
Live as if you were to die tomorrow. Learn as if you were to live forever.
— http://en.wikiquote.org/wiki/Mohandas_Gandhi (Disputed)
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/