I am trying to wrap rsync in NSTask and use the exclude option to not sync hidden files (dot files). I know this works at the command line:
rsync -az --exclude='.*' source destination
My NSTask is defined as follows:
NSTask *rsyncTask;
rsyncTask = [[NSTask alloc] init];
[rsyncTask setLaunchPath: @"/usr/bin/rsync"];
NSArray *arguments;
arguments = [NSArray arrayWithObjects: @"-az", @"--exclude='.*'", source, destination, nil];
[rsyncTask setArguments: arguments];
Without the exclude argument things work fine. In fact things work fine with the above definition but hidden files are still copied.
I have tried:
- escaping the single ticks with a backslash
- using escaped double quotes
- using two backslashes to escape the escaping backslash
- not using --exclude= but just --exclude with a separate array element that is @"'.*'"
Nothing seems to get the results I want.
Any suggestions welcome.