No announcement yet.

skip jpg files during compression

  • Filter
  • Time
  • Show
Clear All
new posts

  • skip jpg files during compression

    I was trying to backup some files by using tar and bzip2 (7z also tried). I noticed certain file types (ex. text, .php) that are text based got compressed fast and had good compression ratio, while pre-compressed file types like jpg was really slow. I was wondering if I can do compression on all but jpg files into the archive and simply add jpg files into the same archive file without compression.

    I've checked tar and bzip2 commands but couldn't find something like "--skip-jpg" parameters. It's a backup job done by a really slow machine (arch linux on arm-based platform) so it would be nice to skip the jpg compression during my scheduled backup routine.

  • #2
    Usually to do this you need to do it in two phases, first add the files you want to compress. You can use exclusion switches such as in 7zip
    -r -x!*.jpg -x!*.jpeg
    You can then add the skipped files with no compression (store).