LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Retrieving file size, or its modification time (https://www.linuxquestions.org/questions/linux-newbie-8/retrieving-file-size-or-its-modification-time-511751/)

_cih_ 12-18-2006 06:49 PM

Retrieving file size, or its modification time
 
Hi all,

I am beginner in bash programming and I am trying to write a script thet retrieves and stores inside some of
its local variables a modification time ( or a size ) of a given file. Are there any syscalls, or other methods to achieve above written ?

Thank you.

unSpawn 12-18-2006 07:09 PM

"stat -c "%s %Y" /some/file" will give you the size in bytes and mtime in epoch.

kassle 12-18-2006 07:10 PM

try

byTime=`ls -l [files] | awk '{ print $6:$7 }'
bySize=`ls -l [files] | awk '{ print $5:$7 }'

_cih_ 12-19-2006 05:48 AM

thanks
 
Thanks for help !


All times are GMT -5. The time now is 05:50 AM.