Aman Thind wrote:

> Hello Friends,
> 
> I wish to archive a folder into a .tar
> 
> I've been searching through the documentation of archive::tar module but
> could not find a way by which I could make the .tar just by specifying the
> folder name (like on unix prompt "tar -cvf myarchive.tar myfoldername")
> and not explicitly stating the filenames.

Archive::Tar has a class method that does exactly like that:

[panda]$ perl -MArchive::Tar -e \ 
'Archive::Tar->create_archive("/tmp/test.tar",0,glob("*.pl"))'

[panda]$ ls -l /tmp
-rw-r--r--    1 x   x  9216 Feb 10 10:59 test.tar

arguments to create_archive:

1. name of the archive you want to create. in your example, it would be 
myarchive.tar

2. compression level from 2 to 9. any other values will use the default 
level.

3. a list of files to add to the archive. in my example above, all files 
ending in .pl will be archived to /tmp/test.tar

david
-- 
sub'_{print"@_ ";* \ = * __ ,\ & \}
sub'__{print"@_ ";* \ = * ___ ,\ & \}
sub'___{print"@_ ";* \ = * ____ ,\ & \}
sub'____{print"@_,\n"}&{_+Just}(another)->(Perl)->(Hacker)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to