I think you have to replace the argument
@"'*.git*'"
by
@"*.git*"
otherwise find will ignore only files that are named '*.git*'
(verbatim). Note that the shell removes the single quotes when you execute the command in the Terminal.
Domanda
I'm trying to get the following find command to work via NSTask:
find /Users/user/projects ! -path '*.git*' -ctime -1
However I am having trouble to get the ignore path part to work. In terminal it works fine. I get the modified files of the last 24 hrs excluding the .git directories. When using NSTask, the .git directories are not ignored, resulting in way too many positives...... I am using the following args:
NSArray *args = @[@"/Users/user/projects", @"!", @"-path", @"'*.git*'", @"-ctime", @"-1"];
Does anybody know what I am doing wrong?
Soluzione 2
I think you have to replace the argument
@"'*.git*'"
by
@"*.git*"
otherwise find will ignore only files that are named '*.git*'
(verbatim). Note that the shell removes the single quotes when you execute the command in the Terminal.
Altri suggerimenti
You may also find it easier to do.
NSString *argString = @"/Users/user/projects ! -path '*.git*' -ctime -1";
[nsTaskName setArguments: [argString componentsSeparatedByString: @" "]];
When you debug your arguments in terminal you can do just do a copy and past and add 'find ' in front of it.