I want to sort only files by update dates including sub-directories.
I found out ls -lrtR | grep ^-
. but it doesn't seem to sort by update dates.
And I need to save this list into a file. Is it possible?
Apr 01 2010 InsideDoosanServiceImpl.class // in A directory
Apr 08 2010 MainController.class // in B directory
Apr 07 2010 RecommendController.class // in B directory
Apr 01 2010 MainDao.class // in B directory
I mean the whole list is not ordered by date, but first ordered by folder, and ordered by date.
I want a list first ordered by date including all sub-directories.
GNU find
does help. But OP works onAIX
machines soGNU find
wasn't available to him. – jaypal singh Jan 18 '12 at 07:52ls
can't be made to accumulate files before sorting.ls
is so fast compared tofind
. – Nathan Arthur Jan 27 '16 at 21:53ls
andfind
reads the same data, so I can't imagine any reason ls should be considerably faster than find. On my system find is 5 times faster (searching through roughly half a million files) – Rolf Rander Jan 27 '16 at 22:01find . -type f -printf "%T@ %Tc %p\n" | sort -n > out.txt
yielding output entries like1427913836.2330520210 wed 1 apr 2015 20:43:56 ./subdir/file.txt
. – Carl Feb 03 '16 at 23:08