code:work:lvisf:2022:fieldarchive:start
This is an old revision of the document!
Table of Contents
Bash Style Archive
Compress All Dirs To A Folder
lvis@lvis-dell-xps:~/bin$ more compress_all_mjd.sh #!/bin/bash echo "Usage $0 <input dir> <output dir>" M_INPUTDIR=$(echo $1 | sed '/\/$/! s|$|/|') # add a slash if necessary M_OUTPUTDIR=$(echo $2 | sed '/\/$/! s|$|/|') # found online echo Input: $M_INPUTDIR echo Output: $M_OUTPUTDIR cd $M_INPUTDIR for f in *; do if [ -d "$f" ]; then M_BASENAME=$(basename $f) re='^[0-9]+$' # check if this is a just a number (day mjd) (found online) if [[ $M_BASENAME =~ $re ]] ; then M_TARFILE="${M_OUTPUTDIR}${M_BASENAME=}_raw_data.tar.gz" echo "Run on $f which is $M_BASENAME" time tar cf - $f | pigz > $M_TARFILE fi fi done
Mount Tar As Filesystem
- https://csatlas.com/mount-tar-file-ubuntu/ ← archivemount HOWTO
Options we might be interested in
-o readonly disable write support -o nobackup remove archive file backups
- Install if not already on the system
sudo apt install -y archivemount
- Create a mount point
mkdir /tmp/myfiles
- Mount the tar file as read only
archivemount myfiles.tar.gz /tmp/myfiles
- Read data out of archive as if it were a file
- Remove the mount <code>
code/work/lvisf/2022/fieldarchive/start.1649438120.txt.gz · Last modified: 2022/04/08 17:15 by david