bash - Find error - unknown primary or operator -
find /volumes/common-lic-photo/staging/completed -type d -maxdepth 2 -iname -iregex '.*_output' -exec rsync -rtwv --stats --progress {} /volumes/common-lic-photo/aspera/aspera_staging/ \;
the code above designed inside directory complete sub-directories phrase "_output" (ignoring case, hence -iname
) @ end of directory name , copy finds new location, aspera_staging. i'm running code in .sh triggered launchcd app launch control whenever new directory moved complete (which part of issue because cron seems picky).
it works half time, other half nothing @ all. output directory won't copied. can't find pattern, seems random. i've noticed in debug log giving me following error:
find: .*_output: unknown primary or operator
i've spent hours tinkering, trying figure out. i've followed lot of suggestions found on here , other sites far nothing has worked. has looking output folders can't bottom of it.
as commenters have noticed, -iname
requires parameter, therefore -iregex
follows understood parameter , parameter -iregex
(mis)taken operator, hence error message.
in context, -iname
, -iregex
seem redundant, command should either:
find /volumes/common-lic-photo/staging/completed -type d -maxdepth 2 -iname '*_output' -exec ... \;
or:
find /volumes/common-lic-photo/staging/completed -type d -maxdepth 2 -iregex '.*_output' -exec ... \;
(notice how parameters -iname
, -iregex
differ)
Comments
Post a Comment