12/19/2023 0 Comments Untar xz fileIf you pass a digit, it's assumed to be the gzip compression level (between 1 and 9), but the use of constants is preferred: # write a gzip compressed file You can compress using gzip, bzip2 or xz. The second argument is used to indicate compression. The first argument can either be the name of a file or a reference to an already open filehandle (a GLOB reference). Note that clear only has effect on the object, not the underlying tarfile. This effectively gives you a 'blank' object, ready to be filled again. # $tar->clearĬlear clears the current in-memory archive. Returns a list of Archive::Tar::File objects that remain. # $tar->remove any entries with names matching any of the given filenames from the in-memory archive. Returns true on success and false on failure. Note that you must specify a Unix path for $new_name, since per tar standard, all files in the archive must be Unix paths. Rename the file of the in-memory archive to $new_name. Make the string $content be the content for the file named $file. # $tar->replace_content( $file, $content ) Please refer to the Archive::Tar::File documentation on how to handle these objects. If no filename list was passed, all Archive::Tar::File objects in the current Tar object are returned. Returns the Archive::Tar::File objects matching the filenames provided. Passing an array reference containing only one element, 'name', is special cased to return a list of names rather than a list of hash references, making it equivalent to calling list_files without arguments. The following list of properties is supported: name, size, mtime (last modified date), mode, uid, gid, linkname, uname, gname, devmajor, devminor, prefix. If list_files() is passed an array reference as its first argument it returns a list of hash references containing the requested properties of each file. Returns a list of the names of all the files in the archive. Returns true on success, false on failure. $tar->extract_file( $at_file_object, 'name/i/want/to/give/it' ) Optionally takes a second parameter, which is the full native path (including filename) the entry will be written to.įor example: $tar->extract_file( 'name/in/archive', 'name/i/want/to/give/it' ) Write an entry, whose name is equivalent to the file name provided to disk. If extract is called without a list of file names, the entire contents of the archive are extracted. However, the length of each element of the path is not inspected to see whether it's longer than MacOS currently allows (32 characters). Under MacPerl, the file's modification time will be converted to the MacOS zero of time, and appropriate conversions will be done to the path. Write files whose names are equivalent to any of the names in to disk, creating subdirectories as necessary. So it cannot compensate for case-insensitive file- systems or compare 2 paths to see if they would point to the same underlying file. Note however, that this function does an exact match using eq on the full path. It will return true if the file is in the archive, false otherwise. # $tar->contains_file( $filename )Ĭheck if the archive contains a certain file. Returns the number of files read in scalar context, and a list of Archive::Tar::File objects in list context. Please consult the Archive::Tar::File documentation for details. This means no Archive::Tar::File objects are created for you to inspect.Īll files are stored internally as Archive::Tar::File objects. Note however that entries will not be read into memory, but written straight to disk. This gives you the same memory break as the extract_archive function. If set to true, immediately extract entries when reading them. $tar->read ( $filename|$handle, [$compressed, #extract.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |