Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #compress BIG folder using hard disk only (to avoid RAM limitations). This will be slow
- #!/bin/bash
- #apt install pigz
- # Define the source directory and output archive file name
- SOURCE_DIR="/mnt/home/downloads_linux/path/to/source"
- OUTPUT_ARCHIVE="/mnt/home/downloads_linux/output.tar.gz"
- # Define a temporary directory for storing intermediate files
- TMP_DIR="/mnt/home/downloads_linux/TEMP"
- # Create the temporary directory if it doesn't exist
- mkdir -p "$TMP_DIR"
- # Use tar and pigz to create a compressed archive
- tar -cf - "$SOURCE_DIR" | pigz -9 -p 4 > "$TMP_DIR/temp_archive.tar.gz"
- # Move the temporary archive to the final destination
- mv "$TMP_DIR/temp_archive.tar.gz" "$OUTPUT_ARCHIVE"
- # Remove the temporary directory
- rm -rf "$TMP_DIR"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement