Hi Everyone!
I need some help with the find command. I'd like to querry pdf files with date and file size in a specific range of date. I have to sum the file size what I get the end of the process.
find / -newermt "2018-01-20" \! -newermt "2018-03-01" -type f -iname '*.pdf' -print0 | xargs -0 du -h >> txt.txt
The first case I get the size and the filename.
find / -type f -iname '*.pdf' -printf "\n%AD %AT %p" -newermt "2018-01-20" \! -newermt "2018-03-01" >> txt.txt
In here I get the date and the filename. I'm beginner in CentOS, so I'd like to ask some help or advice. Thank you!
find command help
Re: find command help
Just add -c option (=count) to du command:
Code: Select all
find / -newermt "2018-01-20" \! -newermt "2018-03-01" -type f -iname '*.pdf' -print0 | xargs -0 du -hc
-
- Posts: 2
- Joined: 2018/03/01 14:25:14
Re: find command help
Thank you!
The next question how can i write before or after the file in the list?
The next question how can i write before or after the file in the list?
Re: find command help
Just to get this right: you want to add elements within every line, right? Maybe you can give an minimal example of wanted output.