0

I'd like to know how to list all folders including the subfolders in, say an external hard drive, with its last modified timestamp(accurate to seconds) in terminal?

I know we can use "ls -lT" to list the timestamp in a certain directory (with files, although I don't need), but I want it to include all the sub-directories as well, with or without the files attributes included.

I also find this command "find . -type d | sed -e "s/[^-][^/]*// |/g" -e "s/|([^ ])/|-\1/"" could show a directory tree. My wish is to have last modified time stamp besides it.

Thanks guys! Sincerely,

Hang
  • 355
  • 3
  • 19
  • `find .` from your parent folder – Abdelouahab Jan 15 '17 at 12:52
  • Thanks for the comment. But this wouldn't print out the time attributes. It lists out all the directories and files in my hard drive though. :D – Hang Jan 15 '17 at 12:58
  • check this http://stackoverflow.com/a/20893429/861487 – Abdelouahab Jan 15 '17 at 13:17
  • 1
    Thanks! After installing binutils (as without it it cannot use stat -c argument), I use "find . -type d -exec stat -c "%n %y" {} \;" to get my work done. This thread does help me! :D – Hang Jan 15 '17 at 14:14

1 Answers1

1

After installing binutils (check https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/), I used

find . -type d -exec stat -c "%n %y" {} \;

to get the work done. Thanks to Abdelouahab and the threads:

https://stackoverflow.com/a/20893429/861487

Binutils stat illegal option -c

Community
  • 1
  • 1
Hang
  • 355
  • 3
  • 19