On Tuesday, 5 September 2023 16:28:31 BST Walter Dnes wrote: > Every so often I tar up my home directory on my main machine, and push > it over to my "hot backup" machine, and then do a tap-dance with the > .ssh directory. I notice oodles of cache files being tarred. Do I > understand the man page correctly about the CACHEDIR.TAG "magic file"? > Assume I have a .cache directory like so... > > [x8940][waltdnes][~] ll .cache > total 64 > drwx------ 12 waltdnes users 4096 Sep 5 10:50 . > drwxr-xr-x 141 waltdnes users 20480 Sep 5 10:58 .. > -rw-r--r-- 1 waltdnes users 0 Sep 5 10:50 CACHEDIR.TAG > drwx------ 2 waltdnes users 4096 Aug 29 15:34 babl > drwxr-xr-x 2 waltdnes users 4096 Sep 5 08:52 fontconfig > drwxr-xr-x 3 waltdnes users 4096 Jun 11 2021 geeqie > drwx------ 3 waltdnes users 4096 May 29 2021 gegl-0.4 > drwxr-xr-x 3 waltdnes users 4096 May 29 2021 gimp > drwx------ 3 waltdnes users 4096 May 27 2021 google-chrome > drwx------ 2 waltdnes users 4096 Sep 5 10:23 mc > drwxr-xr-x 258 waltdnes users 4096 Mar 24 2022 mesa_shader_cache > drwx------ 3 waltdnes users 4096 May 25 2021 'moonchild productions' > drwx------ 3 waltdnes users 4096 Nov 16 2021 thumbnails > > Would a script in /home like... > > #!/bin/bash > tar --exclude-caches-under cvzf wdexport.tgz waltdnes > > ...skip files in that directory? I don't mind a few empty directories.
Have a look at this page which explains what you need to do: https://bford.info/cachedir/ Alternatively, use something like: --exclude=".cache/*" for top level .cache directories.
signature.asc
Description: This is a digitally signed message part.