Sponsored Content
Full Discussion: Equivalent command to 'stat'
Top Forums Shell Programming and Scripting Equivalent command to 'stat' Post 302277038 by agn on Thursday 15th of January 2009 08:05:58 AM
Old 01-15-2009
There's a stat() function in perl which can give you similar results.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

stat command

how can ý use "stat command"????.. (2 Replies)
Discussion started by: emreatlier
2 Replies

2. Shell Programming and Scripting

stat command with ls -l

If i do ls -l i get the result rwx-rw-r ...... ............... file. How can i get the result in octal format. All other output will be the same as ls -l shows. The rwx-rw-r would be like 755 etc. (7 Replies)
Discussion started by: cola
7 Replies

3. Shell Programming and Scripting

hp-unix stat command to get last change date of file

I'm on hp-unix. I would like a variable to hold the last change date of a file. I looked at the man pages for stat, but I don't see any examples and can't get the syntax right. Can anyone help me? Thank you. (2 Replies)
Discussion started by: sboxtops
2 Replies

4. Windows & DOS: Issues & Discussions

Does PowerSHell have *stat command analogs?

I.e. like vmstat, cpustat, iostat, fsstat, kstat ..etc? (1 Reply)
Discussion started by: Xcislav
1 Replies

5. Shell Programming and Scripting

Need file timestamp without stat command

Hi all, I want to check whether a file is not updated in last 15 minutes, for this i need to get timestamp of file, (yyyy:mm:dd:hh:mi:ss). I dont have access to STAT command :(. Please suggest a program or command to do this . Thanks, Saravana (1 Reply)
Discussion started by: sam_1210
1 Replies

6. AIX

smitty equivalent command line command

i know after you do something in smitty via the gui, you can click something in smitty that will show you how to do the same thing via the command line, (not using the gui) can anyone tell me how (2 Replies)
Discussion started by: asyed123
2 Replies

7. Shell Programming and Scripting

AIX and HP-UX equivalent of Linux stat command

To list file permission/access right in octal format, linux has a command 'stat'. For example, we can use the followin - stat -c %a `find . -type f Is there any equivalent command in AIX and HP-UX to give the same result as linux 'stat' command? Please advice. (3 Replies)
Discussion started by: atanubanerji
3 Replies

8. UNIX for Dummies Questions & Answers

Stat command

i know this command does not exist in solaris. however, i read somewhere on this forum that basically everything the stat command provides in other oses can be obtained in solaris using the ls command. i've searched the forum for a while now and i cant find the thread. does anyone know about... (1 Reply)
Discussion started by: SkySmart
1 Replies

9. UNIX for Dummies Questions & Answers

Help with stat command

Hi Experts, I am here with very simple request: #!bin/bash a=`stat -c %y log1.csv` echo $a and this stat command returning value as 2013-08-11 05:42:10.000000000 -0400: But I want to see in mm/dd/yyyy format? any help is highly appreciated thank you ---------- Post... (9 Replies)
Discussion started by: parpaa
9 Replies

10. UNIX for Dummies Questions & Answers

Question on stat command

hello, I wanted to know which is the output of the stat command with a file, for example if I write on the terminal: stat ./unix.pdf i get the output: 754974726 6915670 -rwxrwxrwx 1 mbruno106 staff 0 90501 "Aug 13 13:26:02 2013" "Aug 13 13:26:02 2013" "Aug 13 13:26:02 2013" "Aug 13... (1 Reply)
Discussion started by: Marina2013
1 Replies
explain_stat(3) 					     Library Functions Manual						   explain_stat(3)

NAME
explain_stat - explain stat(2) errors SYNOPSIS
#include <libexplain/stat.h> const char *explain_stat(const char *pathname, const struct stat *buf); void explain_message_stat(char *message, int message_size, const char *pathname, const struct stat *buf); const char *explain_errno_stat(int errnum, const char *pathname, const struct stat *buf); void explain_message_errno_stat(char *message, int message_size, int errnum, const char *pathname, const struct stat *buf); DESCRIPTION
These functions may be used to obtain explanations for stat(2) errors . explain_errno_stat const char *explain_errno_stat(int errnum, const char *pathname, const struct stat *buf); The explain_errno_stat function is used to obtain an explanation of an error returned by the stat(2) function. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (stat(pathname, &buf) < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_stat(err, pathname, &buf)); exit(EXIT_FAILURE); } errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. pathname The original pathname, exactly as passed to the stat(2) system call. buf The original buf, exactly as passed to the stat(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_message_errno_stat void explain_message_errno_stat(char *message, int message_size, int errnum, const char *pathname, const struct stat *buf); The explain_message_errno_stat function is used to obtain an explanation of an error returned by the stat(2) function. The least the mes- sage will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (stat(pathname, &buf) < 0) { int err = errno; char message[3000]; explain_message_errno_stat(message, sizeof(message), err, pathname, &buf); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. pathname The original pathname, exactly as passed to the stat(2) system call. buf The original buf, exactly as passed to the stat(2) system call. explain_message_stat void explain_message_stat(char *message, int message_size, const char *pathname, const struct stat *buf); The explain_message_stat function is used to obtain an explanation of an error returned by the stat(2) function. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (stat(pathname, &buf) < 0) { char message[3000]; explain_message_stat(message, sizeof(message), pathname, &buf); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. pathname The original pathname, exactly as passed to the stat(2) system call. buf The original buf, exactly as passed to the stat(2) system call. explain_stat const char *explain_stat(const char *pathname, const struct stat * buf); The explain_stat function is used to obtain an explanation of an error returned by the stat(2) function. The least the message will con- tain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (stat(pathname, &buf) < 0) { fprintf(stderr, "%s ", explain_stat(pathname, &buf)); exit(EXIT_FAILURE); } pathname The original pathname, exactly as passed to the stat(2) system call. buf The original buf, exactly as passed to the stat(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller AUTHOR
Written by Peter Miller <pmiller@opensource.org.au> explain_stat(3)
All times are GMT -4. The time now is 12:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy