0

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

oula alshiekh
  • 843
  • 5
  • 14
  • 40
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Oct 29 '17 at 14:29

2 Answers2

1

You can use find to print the date of last modification:

find -name 'image*' -printf "%TD %p\n" | grep "^10/25"

or:

find -name 'image*' -ls | grep "Oct 25"
Ipor Sircer
  • 3,069
  • 3
  • 10
  • 15
  • i want to move these files to new folder – oula alshiekh Oct 29 '17 at 13:57
  • "Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once" - https://stackoverflow.com/help/how-to-ask – Ipor Sircer Oct 29 '17 at 14:04
0

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?

OznOg
  • 4,440
  • 2
  • 26
  • 35