I have been struggling to do this. I have multiple .py files located in my directory and subdirectories. I want to find and list all of them with their date and time and return the date and time of the last updated .py file in a variable in the format "+%m-%d-%Y %H:%M:%S".
How can I achieve this?
As of now, I'm able to reach only at this stage where it shows me the stats of the last modified date in terminal. Below is the command I'm using :
find . -path ./ABC -prune -false -o -name '*.py' -exec ls -lat {} + | head -n1 - Here I have specifically mentioned not to search in ./ABC folder.
The output of the above command is :
-rw-rw----+ 1 owner server 8263 Jul 8 09:09 ./apps/Test.py - I'm looking for a way where I can return the date and time of the last updated file (./apps/Test.py in this case) in a variable with the format like 07-08-2021 09:09:30.
Thanks in advance!