Hope someone can help with this:
Am trying to delete session files on /tmp with this command:
find /tmp -name 'sess_*' -user Username -maxdepth 1 $CMD {} \;
but I got these errors:
find: warning: you have specified the -maxdepth option after a
non-option argument -name, but options are not positional (-maxdepth
affects tests specified before it as well as those specified after
it). Please specify options before other arguments.find: paths must precede expression Usage: find [-H] [-L] [-P] [path...] [expression]
I looked for solutions over the web but could not find any. I have deleted other tmp files with other commands and wonder if that affected some volume or socket.
Thank you in advance
findhas three types of options: options that are used to match files (e.g.-name,-user), options that specify actions to perform on the matched files (-print,-exec), and options that control the overall behavior of the command (e.g.-maxdepth,-xdev). The third type must be put before the other two. So it should be: