I am trying to get the latest modification date in a directory tree. This works fine in terminal:
find . ! -path "*.git*" -exec stat -f "%m" \{} \; | sort -n -r | head -1
But when I try this with NSTask I get
find: -exec: no terminating ";" or "+"
In the args array for NSTask which I am using, I escaped the backslashes:
NSArray *args = @[@".",
@"!",
@"-path",
@"*.git*",
@"-exec",
@"stat",
@"-f",
@"%m",
@"\\{}",
@"\\;",
@"|",
@"sort",
@"-n",
@"-r",
@"|",
@"head",
@"-1"];
So, what am I missing here? I also tried to remove the backslahes all together, but that gave me a "find: |: unknown primary or operator" error.