I use command like this:
tar cf - /folder-with-big-files -P | pv -s $(du -sb /folder-with-big-files | awk '{print $1}') > big-files.tar.gz
from THIS site. It works very good but I need to exclude 2 folders in TAR and DU command and I have a problem with this. Perhaps there is a probelm with the order?
I tried this:
tar cf --exclude={"/data/media/0/!Temp/!Test/bellota","/data/media/0/!Temp/!Test/Xiaomi"} "$mainLocation" - "$mainLocation" -P | pv -s $(du -sb --exclude={"/data/media/0/!Temp/!Test/bellota","/data/media/0/!Temp/!Test/Xiaomi"} "$mainLocation" "$mainLocation" | awk '{print $1}') > "$tarArchiveLocationWithName"
but this command doesn't works.
My primary code from script:
#!/bin/bash
mainLocation='/data/media/0/!Temp/!Test'
tarArchiveLocationWithName="/data/media/0/!Temp/!backup-$(date +%Y-%m-%d_%H-%M-%S).tar"
tar cf - "$mainLocation" -P | pv -s $(du -sb "$mainLocation" | awk '{print $1}') > "$tarArchiveLocationWithName"