0

I want to backup my savegames:

+ /Library/Containers/com.doublefine.dfaosx/***
+ /Library/Containers/com.doublefine.dottosx/***

I initially wanted to do this as part of a larger rsync backup. However, because of some macOS sandbox insanity, the folders include dozens of symlinks that I don't want to backup up, and excluding these has proven difficult with rsync (see related question).

How can I backup only the valuable savegame files and exclude the symlinks, without explicitly specifying a lot of subfolders. I want to specify "Back up all real files under this root folder, excluding symlinks and subfolders that don't ultimately contain a real file".

I tried zip also, but it doesn't even seem to have an option to exclude symlinks. Can tar do it? It would be best if rsync can do it, but if not, any standard Unix tool would be acceptable.

The files I want to backup are as below. Of course I could specify them explicitly, but I want to learn a way to backup real files and ignore symbolic links without getting specific about it.

Library/Containers/com.doublefine.dfaosx/Container.plist
Library/Containers/com.doublefine.dfaosx/Data/Documents/BrokenAge/saves/*
Library/Containers/com.doublefine.dfaosx/Data/Library/Saved Application State/com.doublefine.dfaosx.savedState/*

The files in saves are called auto.sav, auto.cav, slot_1.sav, slot_2.sav and then some.

Example of symbolic links are (there are about 60 of these, most of which are irrelevant for the game, they are just created by default as a means of reaching some Library files):

Library/Containers/com.doublefine.dfaosx/Data/Library/ColorPickers
  • Do these "game files" have the same name? – fd0 May 28 '18 at 13:07
  • 1
    Are the targets of the symlinks within the folders you want to backup or outside? In both cases how would you restore from backup if you don't include the symlinks? Also, do you know the names of the files you actually want to backup (and do these names stay stable)? – nohillside May 28 '18 at 13:08
  • @nohillside: The symlinks are not used by the game. The names are numbered, but stay stable. – forthrin May 28 '18 at 15:47
  • Are you sure that Library/Containers/com.doublefine.dfaosx/Data/Library/Saved Application State/com.doublefine.dfaosx.savedState/ doesn't contain a symlink in-between? – nohillside May 28 '18 at 17:32
  • @nohillside: Real directories all the way. – forthrin May 28 '18 at 20:15
1

You can pass a list of file names to backup to tar by running find first:

cd ~/Library/Containers/
tar -T <(find com.doublefine.dfaosx -type f -print) -cvzf ~/dfaosx.tar.gz
tar -T <(find com.doublefine.dottosx -type f -print) -cvzf ~/dfaosx.tar.gz

If you prefer rsync it supports a --files-from option which more or less does the same as -T for tar.

  • Not bad! An acceptable alternative if I can't make it work with the main rsync backup. – forthrin May 28 '18 at 20:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .