I've around 11K log files of specific date let say 26Feb inside one directory(there are other date data also). To copy only 26th Feb log files to destination from linux command line, I use below commands.

[root@achal logs]# ls -lrt | grep "Feb 26" | wc -l


[root@achal logs]# find . -type f -newermt 'Feb 26' -exec cp {} 26Feb_UE_HISTORY/ \;

But it copies other date files also, not only 26th Feb files.

Any help is appreciated.


Your selection finds all files newer than Feb 26. So you have to exclude the files modified after Feb 26:

find . -type f -newermt 'Feb 26' ! -newermt 'Feb 27' -exec cp {} 26Feb_UE_HISTORY/ \;
| improve this answer | |
  • Thanks @muclux. It works perfectly. – Achal Mar 3 '19 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.