REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.44 KB
Close
/opt/cloudlinux/alt-php54/root/usr/share/doc/pear/Archive/docs/example.php
Text
Base64
<?php /** * @package Archive */ // Add "MyDirectory" to a new archive: myArchive.tar // [ tar -cf myArchive.tar MyDirectory ] $ar = new Tar( "myArchive.tar" ); $ar->append( "MyDirectory" ); // Show the files in the archive. // [ tar -tf myArchive.tar ] $fileListing = $ar->getList(); foreach( $fileListing as $file ) { print( "Archived file: $file\n" ); } // Append the file /etc/passwd // [ tar -rf myArchive.tar /etc/passwd ] $ar->append( "/etc/passwd" ); // Delete the directory and it's contents // [ tar -f myArchive.tar --delete MyDirectory ] $ar->delete( "MyDirectory" ); // Append another directory .. $ar->append( "AnotherDirectory" ); // .. and show detailed file permissions plus the file or directory path. $fileListing = $ar->getList(); foreach( $fileListing as $file ) { $entry = $ar->getArchivedEntry( $file ); print( $entry->getPermissionsString() ); if ( $entry->isDirectory() ) { print( " [ ".$entry->getPath()." ]\n" ); } else { print( " ".$entry->getPath()."\n" ); } } // Extract the whole archive to the tmp directory $ar->extractTo( "/tmp/" ); // Extract the passwd file to the file: /tmp/passwd-backup $ar->extractTo( "/tmp/passwd-backup", "passwd" ); // Extracting the gzipped archive: compressedTar.tgz to the tmp directory: $ar = new Tar( "compress.zlib://compressedTar.tgz" ); $ar->extractTo( "/tmp/" ); // .. and append the password file. $ar->append( "/etc/passwd" ); ?>
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 11
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
CREDITS
229 B
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
example.php
1.44 KB
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LICENSE
1.53 KB
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tutorial.txt
4.96 KB
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tutorial_autoload.php
495 B
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tutorial_directories.php
390 B
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tutorial_extract.php
532 B
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tutorial_iterator.php
298 B
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tutorial_read_only.php
383 B
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tutorial_recursive.php
949 B
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
tutorial_replacing.php
390 B
lrw-r--r--
2019-12-18 11:17:09
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).