1

I'd like to do a single-command backup of a number of folders and files on my OSX machine. The problem is the root directory.

Basically, I want to zip up - all the files in the root of my home dir (~) but not to recurse - recursively get the contents of ~/Documents, ~/Music, ~/Pictures

Basically: how do I tell zip to use -r for some directories and not others, or is there another way? I do not want to use tar (I want an encrypted archive) and would prefer to not have to install another tool e.g. 7zip.

1 Answer 1

1

-@ tells zip to read the list of files to archive from stdin. You can use the find command to list the files you want and pipe them to zip.

e.g., in your home directory execute:

( find . -type f -maxdepth 1 ; find Documents ) | zip backup.zip -@

The first find lists the top level files in the current directory, the second lists everything in Documents recursively.

You must log in to answer this question.

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