I want to run a script to acquire file details with file creation date (with time) and last access date (with time). I want to run the script in a directory and want the script to show the details of all files in that directory as well in subdirectories. Here is the script which I tried, but I am not able to get subdirectory files.

#! /bin/zsh - 
zmodload zsh/stat for f (*(DN)) { 
    stat -LH s -F %F -- $f && 
    printf '%-58s %s %s\n' $f $s[mtime] $s[atime]
  • OS: Solaris 5.10
  • FileSystem: VFS
  • What did you tried ? Can you share your actual script ? Unix&Linux isn't "do my job for free" site ... we are here to help you on the base of your current work and achievement. – binarym Nov 7 '19 at 10:23
  • Hey Binarym, I certainly understand your concern!! Here is the script which I tried. #! /bin/zsh - zmodload zsh/stat for f (*(DN)) { stat -LH s -F %F -- $f && printf '%-58s %s %s\n' $f $s[mtime] $s[atime] } – Akki Nov 7 '19 at 10:36
  • @Akki the right place to show your existing effort is in the question, by editing it. You might also mention the filesystem(s) you're on, in case they offer varying levels of support in a file's ctime and atime. – Jeff Schaller Nov 7 '19 at 13:21
  • Can someone please help with this? – Akki Nov 11 '19 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.