Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How do you get the last modification date of a file? Post 302764023 by bakunin on Wednesday 30th of January 2013 10:35:41 PM
Old 01-30-2013
Which OS do you work on? Linux "stat" knows the "-c" option as per the man page, but that does not necessarily have to be the case for any other UNIXoid derivate out there.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

command for modification date of a file

Good morning, I would like to find all files of a certain type and display their name as well as their modification date. In order to do this, I would do the following: find ./ -name *.csv | ???????? My question: what to put after the pipe instead of the question marks? Is there a basic... (5 Replies)
Discussion started by: scampsd
5 Replies

2. UNIX for Dummies Questions & Answers

Search by modification date

Hi I'd like to know if is it possible to find files given a certain modification date (say, 01-05-2006, that's 1st of May 2006) I can calculate the days backward: find / -ctime 23 but I wish to search by exact modification day Thanks (5 Replies)
Discussion started by: slink
5 Replies

3. UNIX for Dummies Questions & Answers

Shell script: last modification date for a file

Hi i have a ques in Shell scripting: ques: accept a filename as a command line argument. Validate the input and display the last modification date for that file. Help pls. (4 Replies)
Discussion started by: onlyc
4 Replies

4. Shell Programming and Scripting

List the file or files with last modification date

hi. I need help my programing friends :p I need to list all the files with a certain name (for example FileName) by last modification date but only the one with the last date. If there are two files with the same name and same modification date it should print the both. For example in this set... (6 Replies)
Discussion started by: KitFisto
6 Replies

5. Homework & Coursework Questions

How do I get at the modification date for a file as a variable for a script?

I realize this is basic and probably obvious, but I'm pulling my hair out. I'm guessing this is just some flag on the file command or somesuch, but I can't find it. Help me get unstuck please? EDIT: I guess what I'm asking is once I've got the ls -l output for a file, what command do I use to... (3 Replies)
Discussion started by: Timespike
3 Replies

6. UNIX for Dummies Questions & Answers

Last modification date without 'ls'

Hi, I'm executing a script to check if a file has been modified on a shared folder. I use this to start another script every time the file has been modified. To do this I use the 'ls' command to get the last modification date of the file. My problem is that the computer hosting the shared... (5 Replies)
Discussion started by: Peuj
5 Replies

7. OS X (Apple)

get file modification date in number format (yyyy mm dd hh mm ss)

How do i get the file modification date in number format (yyyy mm dd hh mm ss) i used ls -l pathname but month is still in text "Aug" and year and time is not allways shown. time is show if it is in this year. and year is shown if it is before this year. what do i need to get... (7 Replies)
Discussion started by: rvdokkum
7 Replies

8. Shell Programming and Scripting

Date Modification

Hello all ! I have a piece of code that generates the date of one day ago: /usr/bin/gdate --date='1 day ago' | awk '{print $2 " " $3}' Nov 3 I want the output to be in the form : Nov 03 What other operation should I do for that ? Help (2 Replies)
Discussion started by: Junaid Subhani
2 Replies

9. Programming

File date/time modification and permissions

First, oh great Unix gurus, forgive if this is a stupid question. Unix/Linux is not my main thing but I have been programming in C/C++ for many years. I will do my best to be specific. I have a program in C/C++ that needs to modify the time of a given file. Currently I do this using utime()... (5 Replies)
Discussion started by: Pug
5 Replies

10. Shell Programming and Scripting

Subtract a file's modification date with current date

SunOS -s 5.10 Generic_147440-04 sun4u sparc SUNW,SPARC-Enterprise Hi, In a folder, there are files. I have a script which reads the current date and subtract the modification date of each file. How do I achieve this? Regards, Joe (2 Replies)
Discussion started by: roshanbi
2 Replies
FSTATAT(2)						     Linux Programmer's Manual							FSTATAT(2)

NAME
fstatat - get file status relative to a directory file descriptor SYNOPSIS
#include <fcntl.h> /* Definition of AT_* constants */ #include <sys/stat.h> int fstatat(int dirfd, const char *pathname, struct stat *buf, int flags); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): fstatat(): Since glibc 2.10: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L Before glibc 2.10: _ATFILE_SOURCE DESCRIPTION
The fstatat() system call operates in exactly the same way as stat(2), except for the differences described in this manual page. If the pathname given in pathname is relative, then it is interpreted relative to the directory referred to by the file descriptor dirfd (rather than relative to the current working directory of the calling process, as is done by stat(2) for a relative pathname). If pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted relative to the current working directory of the calling process (like stat(2)). If pathname is absolute, then dirfd is ignored. flags can either be 0, or include one or more of the following flags ORed: AT_EMPTY_PATH (since Linux 2.6.39) If pathname is an empty string, operate on the file referred to by in which case the call operates on the file referred to by dirfd (which may have been obtained using the open(2) O_PATH flag). In this case, dirfd can refer to any type of file, not just a direc- tory. AT_NO_AUTOMOUNT (since Linux 2.6.38) Don't automount the terminal ("basename") component of pathname if it is a directory that is an automount point. This allows the caller to gather attributes of an automount point (rather than the location it would mount). This flag can be used in tools that scan directories to prevent mass-automounting of a directory of automount points. The AT_NO_AUTOMOUNT flag has no effect if the mount point has already been mounted over. AT_SYMLINK_NOFOLLOW If pathname is a symbolic link, do not dereference it: instead return information about the link itself, like lstat(2). (By default, fstatat() dereferences symbolic links, like stat(2).) RETURN VALUE
On success, fstatat() returns 0. On error, -1 is returned and errno is set to indicate the error. ERRORS
The same errors that occur for stat(2) can also occur for fstatat(). The following additional errors can occur for fstatat(): EBADF dirfd is not a valid file descriptor. EINVAL Invalid flag specified in flags. ENOTDIR pathname is relative and dirfd is a file descriptor referring to a file other than a directory. VERSIONS
fstatat() was added to Linux in kernel 2.6.16; library support was added to glibc in version 2.4. CONFORMING TO
POSIX.1-2008. A similar system call exists on Solaris. NOTES
See openat(2) for an explanation of the need for fstatat(). The underlying system call employed by the glibc fstatat() wrapper function is actually called fstatat64(). SEE ALSO
openat(2), stat(2), path_resolution(7), symlink(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2013-07-21 FSTATAT(2)
All times are GMT -4. The time now is 11:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy