How would you go about backing up just some files and subdirectories of a given directory to a compressed archive so that the tree structure could then easily be recreated from that archive.Basically, rsync, with a little bit of scripting around (to select the files and folders I need) does the job, except I don't want to just copy. I need an additional layer that compresses the files being rsynced into some kind of compressed archive (which could then be restored with the paths being recreated). Rsync doesn't necessarily have to be part of the solution.E.g., can I mount an archive on so that everything that goes to that mount point gets compressed?
Backing Up to a Compressed Archive on Linux
backup;rsync;archive;compression
As you already have the script to select only the files you want, why not tar? It preserves the directory structure, it can compress with simple command line flags (-z or -j. It's a single file, so easier to move around, and it's a well-known and ubiquitous tool.tar cfj archive.tar.bz2 ${myfiles[@]}