Skip to content
Advertisement

find files with specific name and specific date command returns wrong result [closed]

I am using centos 7 if I want to find files that starts with the word image in the directory A

i issue the following command

  find  /A -name 'image*'

and in order to write the command that find files that have specific name and issued on specific date and let it be 25/10/2017 for example

Iam issuing the command

find -name 'image*' | ls -ali | grep 'Oct 25'

but it greps all files in the folder what is wrong in this command

Advertisement

Answer

You command seems wrong, you probably missed the xargs:

find -name 'image*' | xargs ls -ali | grep 'Oct 25'

without xargs, the ouput of find is just thrown away and you take the ls -ali of the current directory, which is probably not what you want.

nevertheless find has options to add the date as a search criterion, not sure that’s what you really need, but you may have a look

How to use ‘find’ to search for files created on a specific date?

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement