Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- SRCDIR="/storage/baba"
- DSTDIR="/storage/bubu/"
- function PrintStat()
- {
- Before=$(du -sh "${SRCDIR}" | awk '{print $1}')
- After=$(du -sh "${DSTDIR}" | awk '{print $1}')
- echo "${Before}:${After}"
- }
- function ArchiveTARGZ()
- {
- echo -n "Test: tar + gz + split:"
- mkdir -p "${DSTDIR}"
- cd "${DSTDIR}"
- # gzip compress in tar then split at every 1g
- tar zcf - "${SRCDIR}" 2> /tmp/tar-err.log | split -b 1000000000 - arch
- PrintStat
- cd ~/
- rm -r "${DSTDIR}"
- }
- function Archive7z()
- {
- echo -n "Test: 7z:"
- mkdir -p "${DSTDIR}"
- cd "${DSTDIR}"
- 7zr -v1g a arch "${SRCDIR}" > /tmp/7z.log 2>&1
- PrintStat
- cd ~/
- rm -r "${DSTDIR}"
- }
- function ArchiveCPIO()
- {
- echo -n "Test: cpio:"
- mkdir -p "${DSTDIR}"
- cd "${DSTDIR}"
- find "${SRCDIR}" -depth -type f -print | cpio --format=newc -o | gzip -c | split -b 1000000000 - arch
- PrintStat
- cd ~/
- rm -r "${DSTDIR}"
- }
- function ArchiveDAR()
- {
- echo -n "Test: dar:"
- mkdir -p "${DSTDIR}"
- cd "${DSTDIR}"
- dar -y -s 1000M -c "arch" -R "${SRCDIR}" > /tmp/dar.log 2>&1
- PrintStat
- cd ~/
- rm -r "${DSTDIR}"
- }
- function ArchiveARJ()
- {
- echo -n "Test: arj:"
- mkdir -p "${DSTDIR}"
- cd "${DSTDIR}"
- arj a -y -r -v1g "arch" "${SRCDIR}" > /tmp/arj.log 2>&1
- PrintStat
- cd ~/
- rm -r "${DSTDIR}"
- }
- #time ArchiveTARGZ
- #Archive7z
- #time ArchiveCPIO
- time ArchiveDAR
- #time ArchiveARJ
Advertisement
Add Comment
Please, Sign In to add comment