Bash Script

Hi Team,

I have a requirement where I need to fetch latest files received today. This means

Ex:  path /bin/Parent_folder
In this Parent_folder we have 10 child directories. Vendors places files into these child directories respectively on different dates.

Now I need the list of files with folder name - received/added to these child directories.

Ex : If vendor places one new file in  child_folder2 and two new files in child_folder 5 then
I need this details to be logged to some txt/csv files.

I am sorry if my requirement is not clear, please let me know if you have more questions.

Thank you so much
Who is Participating?
farzanjConnect With a Mentor Commented:
It appears that you need a find command

find /bin/Parent_folder -type f -mtime -2 > log.txt

So basically in this path any ordinary file that has been modified for less than 2 days.
parpaaAuthor Commented:
Hi farzanj,

This is great, You are right this is something I am looking for.

Can I also add last modified date to this log.txt ?

Thank you so much for your help here. Much appreciated.
MikeOM_DBAConnect With a Mentor Commented:
Adding to farzanj's comment, I would recommend that once you "process" the received files, move them to another directory and maintain the receiving directories "clean".
parpaaAuthor Commented:
This is great Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.