Sponsored Content
Full Discussion: Listing File Info
Top Forums Programming Listing File Info Post 31390 by Perderabo on Thursday 7th of November 2002 08:14:13 AM
Old 11-07-2002
Once you have the file name, use that with the lstat() system call. This will return you a all of the inode information in a stat structure. Then you can just print out the elements of the structure. It should be pretty easy. Take a look at the man page for lstat().
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File listing

I can't seem to list all the files that begin with a lower case or upper case letter between a-m while being in that directory? Please help I've tried everything from all the ls commands to even grep commands. b (5 Replies)
Discussion started by: Astudent
5 Replies

2. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies

3. Shell Programming and Scripting

listing file with other format

Hello. If i use ls to list file, the output will be like this: ls list* list1.txt list2.txt list3.txt list4.txt list5.txt How can I list file like below (I tried to us ls -ltr list*.txt, but all of them with time, date in font of the file...but I don't need it)? list1.txt... (3 Replies)
Discussion started by: happyv
3 Replies

4. Solaris

file listing ...

Hi experts, I have several hundred files for everyday each month (below example is September)- PP023149200709010546.......PP028023200709012300 PP023150200709020023.......PP026096200709022134 .. .. PP021256200709201920.......PP025576200709202218 .. ..... (3 Replies)
Discussion started by: thepurple
3 Replies

5. Shell Programming and Scripting

listing the latest file

if i am having files as below in a directory---- -rwxrwxrwx 1 dsadm dstage 43 Nov 21 2005 CheckfreeFtpSeq.err -rwxrwxrwx 1 dsadm dstage 37 Jun 22 2007 EDIRemitVendorAdviceSeq.log -rwxrwxrwx 1 dsadm dstage 43 Jun 22 2007 EDIRemitVendorAdviceSeq.err... (2 Replies)
Discussion started by: Sagarddd
2 Replies

6. Shell Programming and Scripting

How do I get only the file name from a listing?

Hi, I am trying to get a file name only. Could anyone help me on the same. Meaning I have a file say list.out which holds below output ./xyz/abc.txt ./xyz/hij.txt I want an output as below abc.txt hij.txt i.e I want to delete everything before abc.txt Please help me out if any one has... (4 Replies)
Discussion started by: spark
4 Replies

7. UNIX for Dummies Questions & Answers

Listing file name and date

Hello. I want to make an unix script which create a file with the name and the date of creation of the different files that there are in a directory. Can do you please help me? Thank you in advance. (3 Replies)
Discussion started by: Jfka
3 Replies

8. UNIX for Dummies Questions & Answers

[Solved] How to remove listing of current user cmd from ps -ef listing?

Hi All, Could you please help to resolve my following issues: Problem Description: Suppose my user name is "MI90". i.e. $USER = MI90 when i run below command, i get all the processes running on the system containing name MQ. ps -ef | grep MQ But sometimes it lists... (8 Replies)
Discussion started by: KDMishra
8 Replies

9. UNIX for Advanced & Expert Users

Listing file issue

I have the three following files available in the directory. But the job should be able to read only the first two files. Could any one help me in writing command to list only the first two files and omit the last file. I used ls -1 LSM_REP* > final.lst. It is copying all the three files. But I... (5 Replies)
Discussion started by: Ram Nukavarapu
5 Replies

10. Shell Programming and Scripting

File Listing, with a Twist?

Greetings! I have a quick question which must be deferred to those with greater skill than myself :) In this situation, I wish to create a list of all the files on an entire partition in descending order sorted by date. I tried numerous switches for ls, and found this line to be the closest... (4 Replies)
Discussion started by: LinQ
4 Replies
LSTAT(P)						     POSIX Programmer's Manual							  LSTAT(P)

NAME
lstat - get symbolic link status SYNOPSIS
#include <sys/stat.h> int lstat(const char *restrict path, struct stat *restrict buf); DESCRIPTION
The lstat() function shall be equivalent to stat(), except when path refers to a symbolic link. In that case lstat() shall return informa- tion about the link, while stat() shall return information about the file the link references. For symbolic links, the st_mode member shall contain meaningful information when used with the file type macros, and the st_size member shall contain the length of the pathname contained in the symbolic link. File mode bits and the contents of the remaining members of the stat structure are unspecified. The value returned in the st_size member is the length of the contents of the symbolic link, and does not count any trailing null. RETURN VALUE
Upon successful completion, lstat() shall return 0. Otherwise, it shall return -1 and set errno to indicate the error. ERRORS
The lstat() function shall fail if: EACCES A component of the path prefix denies search permission. EIO An error occurred while reading from the file system. ELOOP A loop exists in symbolic links encountered during resolution of the path argument. ENAMETOOLONG The length of a pathname exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. ENOTDIR A component of the path prefix is not a directory. ENOENT A component of path does not name an existing file or path is an empty string. EOVERFLOW The file size in bytes or the number of blocks allocated to the file or the file serial number cannot be represented correctly in the structure pointed to by buf. The lstat() function may fail if: ELOOP More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the path argument. ENAMETOOLONG As a result of encountering a symbolic link in resolution of the path argument, the length of the substituted pathname string exceeded {PATH_MAX}. EOVERFLOW One of the members is too large to store into the structure pointed to by the buf argument. The following sections are informative. EXAMPLES
Obtaining Symbolic Link Status Information The following example shows how to obtain status information for a symbolic link named /modules/pass1. The structure variable buffer is defined for the stat structure. If the path argument specified the filename for the file pointed to by the symbolic link ( /home/cnd/mod1), the results of calling the function would be the same as those returned by a call to the stat() function. #include <sys/stat.h> struct stat buffer; int status; ... status = lstat("/modules/pass1", &buffer); APPLICATION USAGE
None. RATIONALE
The lstat() function is not required to update the time-related fields if the named file is not a symbolic link. While the st_uid, st_gid, st_atime, st_mtime, and st_ctime members of the stat structure may apply to a symbolic link, they are not required to do so. No functions in IEEE Std 1003.1-2001 are required to maintain any of these time fields. FUTURE DIRECTIONS
None. SEE ALSO
fstat() , readlink() , stat() , symlink() , the Base Definitions volume of IEEE Std 1003.1-2001, <sys/stat.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 LSTAT(P)
All times are GMT -4. The time now is 03:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy