To run this:
pip3 install -r requirements.txt
-
Output:
python tar.py --help
usage: tar.py [-h] [-t TARFILE] [-p PATH] [-f FILES] method TAR file compression/decompression using GZIP. positional arguments: method What to do, either 'compress' or 'decompress' optional arguments: -h, --help show this help message and exit -t TARFILE, --tarfile TARFILE TAR file to compress/decompress, if it isn't specified for compression, the new TAR file will be named after the first file to compress. -p PATH, --path PATH The folder to compress into, this is only for decompression. Default is '.' (the current directory) -f FILES, --files FILES File(s),Folder(s),Link(s) to compress/decompress separated by ','.
- If you want to compress one or more file(s)/folder(s):
This will compress the folder
python tar.py compress -f test_folder,test.txt
test_folder
and the filetest.txt
into a single TAR compressed file named:test_folder.tar.gz
If you want to name the TAR file yourself, consider using-t
flag. - If you want to decompress a TAR file named
test_folder.tar.gz
into a new folder calledextracted
for instance:A new folderpython tar.py decompress -t test_folder.tar.gz -p extracted
extracted
will appear that contains everything ontest_folder.tar.gz
decompressed.