I'm using the below command but it is not working
find . PYRLLPS_GL_201610D2* -maxdepth 1 -mtime -30
I get the below error
find: bad option -maxdepth
find: [-H | -L] path-list predicate-list
I'm using the below command but it is not working
find . PYRLLPS_GL_201610D2* -maxdepth 1 -mtime -30
I get the below error
find: bad option -maxdepth
find: [-H | -L] path-list predicate-list
-maxdepth is not specified by POSIX. It appears your version of find doesn't support that primary.
Ways to accomplish the same effect using only POSIX options are discussed here:
Also, it's unclear what you're trying to do but you may have the usage of find itself confused:
If you are trying to find all files with names that start with PYRLLPS_GL_201610D2, you should be using the -name operator, and protecting the pattern itself from expansion (shell globbing) so that find sees the pattern itself, rather than the pattern being expanded by the shell.
Something like so:
find . -path '*/*/*' -prune -o -name PYRLLPS_GL_201610D2\* -mtime -30 -print
If you are trying to find all files with -mtime -30 that are directly within either the current directory or within one of the PYRLLPS_GL_201610D2* directories in the current directory, then you have the right idea and are just missing the -maxdepth workaround linked above.
find . -maxdepth 1 -name PYRLLPS_GL_201610D2* -mtime -30
If you want to find file named like PYRLLPS_GL_201610D2AAAA ,you need the code:
find . -maxdepth 1 -name 'PYRLLPS_GL_201610D2*' -mtime -30