03-25-2015
According to the standards, the
utime(path, times) function is required to return -1 with errno set to EPERM (which is 1 on most UNIX Systems) when:
Quote:
The times argument is not a null pointer and the effective user ID of the calling
process does not match the owner of the file and the calling process does not
have appropriate privileges.
The system you're using seems to be meeting the requirements of the standards on this issue.
This User Gave Thanks to Don Cragun For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Does anyone know how to display the time with seconds
of when a file was last modified. I can get hour & minutes but
would also like seconds. --Running AIX (1 Reply)
Discussion started by: edog
1 Replies
2. UNIX for Dummies Questions & Answers
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
3. UNIX for Dummies Questions & Answers
Hi
I am accessing a file on nfs mounted device, after completing using of the file, i am tring to restore the access time and modification times of the file.
So i got the previous modified time of the file using stat() function and trying to set the date and time for the file, To set these... (6 Replies)
Discussion started by: deepthi.s
6 Replies
4. Shell Programming and Scripting
How can I get and display the last modification time of a file? in scripting or specifically using Batch file
I want this info for me to determine whether an image has been edited or not by using the last modification time and compare it to our stored date of modification.
can somebody help... (5 Replies)
Discussion started by: jaque18
5 Replies
5. Shell Programming and Scripting
Hi All,
I would like to know the file modification time till seconds in Unix. So I tried ls -e and it worked fine. This Solaris 5.10
-rw-rw-r-- 1 test admin 22 Sep 12 11:01:37 2008 test_message
But I am not able to run the same command in SOlaris 5.6 and also in AIX/HP
Is there... (3 Replies)
Discussion started by: rahulkav
3 Replies
6. Shell Programming and Scripting
Hi All,
I have two files (given below) each exists under different paths. I want to compare the modification time stamp of file1.txt is lessthan the modification time of file2.txt.
month1=`ls -l file1.txt | awk '{ print $6}'`
date1=`ls -file1.txt | awk '{ print $7}'`
time1=`ls... (1 Reply)
Discussion started by: Arunprasad
1 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
I need the modification time of a file on a particular day say 3 days before.
I just don't want the last modification time. I need all the modification times on a particualar day.
Is there anyway to do it? Kindly help. Could anyone tell me where the modification time is stored?... (1 Reply)
Discussion started by: vidhyab
1 Replies
8. UNIX for Dummies Questions & Answers
I'm trying to get the date output to be in the form yyyy-mm-dd (e.g. 2013-01-18)
!/bin/sh
modDate=$(stat -c %y $1)
echo $modDate >> $1
When I run this on another file (by typing ./dateScript theFile.txt), I keep getting this message:
stat: illegal option -- c
What's wrong with my code... (2 Replies)
Discussion started by: Nate18
2 Replies
9. Shell Programming and Scripting
Explain it with proper e.g (4 Replies)
Discussion started by: sidpatil
4 Replies
10. Shell Programming and Scripting
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
utime(2) System Calls utime(2)
NAME
utime - set file access and modification times
SYNOPSIS
#include <sys/types.h>
#include <utime.h>
int utime(const char *path, const struct utimbuf *times);
DESCRIPTION
The utime() function sets the access and modification times of the file pointed to by path, and causes the time of the last file status
change (st_ctime) to be updated.
If times is NULL, the access and modification times of the file are set to the current time. A process must be the owner of the file or
have write permission to use utime() in this manner.
If times is not NULL, times is interpreted as a pointer to a utimbuf structure (defined in <utime.h>) and the access and modification times
are set to the values contained in the designated structure. Only the owner of the file or a process that has the {PRIV_FILE_OWNER} privi-
lege asserted in its effective set can use utime() in this manner.
The utimbuf structure contains the following members:
time_t actime; /* access time */
time_t modtime; /* modification time */
The times contained in the members of the utimbuf structure are measured in seconds since 00:00:00 UTC, January 1, 1970.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The utime() function will fail if:
EACCES Search permission is denied by a component of the path prefix.
EACCES The process does not have appropriate privileges and is not the owner of the file, write permission is denied for the file,
and times is NULL.
EFAULT The path argument points to an illegal address.
EINTR A signal was caught during the execution of the utime() function.
EIO An I/O error occurred while reading from or writing to the file system.
ELOOP Too many symbolic links were encountered in translating path.
ENAMETOOLONG The length of the path argument exceeds PATH_MAX, or the length of a path component exceeds NAME_MAX while _POSIX_NO_TRUNC
is in effect.
ENOENT The named file does not exist or is a null pathname.
ENOLINK The path argument points to a remote machine and the link to that machine is no longer active.
ENOTDIR A component of the path prefix is not a directory.
EPERM The effective user of the calling process is not the owner of the file, {PRIV_FILE_OWNER} is not asserted in the effective
set of the calling process, and times is not NULL.
EROFS The file system containing the file is mounted read-only.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Async-Signal-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
stat(2), utimes(2), attributes(5), privileges(5), standards(5)
SunOS 5.10 19 Apr 2004 utime(2)