Two small things....firstly "ctime" is not the "create" time but the "change" time - probably best to read the man page to make sure you understand the difference between mtime and ctime. Secondly you will probably need to escape or quote the wildcard, eg:
Cheers...
Hi All,
Im having a file named logserver.txt. I want a perl script to take a backup of that file, along with the datestamp; move the file to a different location or empty the contents of the file after backup.
Remember, the file gets generated when the related service starts. My condition is... (14 Replies)
Give shell script....which takes two file names as input and compares the contents, is both are same delete second file's contents.....
I try with "diff"...... but confusion how to use "diff" with if ---else
Thanking you (5 Replies)
Under TEMP folder, it have many sub-folder, example"0015,0016,etc"
I need to discovery those file which are 2 days ago in this sub-folder , and list out to investigate, at the end delete all file in those sub folder, only keep the emptu directory. Thanks (4 Replies)
Hi Guys,
I need help on deleting particular date files in a directory. I have to delete thousands of files with respect to particular date. Could anyone help on this to delete particular date files at a time?
Thanks in Advance (2 Replies)
Hello all! I am writing a script that takes in a directory name as input and if the directory exists, it shows the files inside the directory
here is what I have so far (incomplete) (mostly like pseudocode)
#/bin/sh
echo Please enter the name of a directory
read dir
grep $dir... (2 Replies)
Hi all
This is my first post. Please bear with me with all my mistakes. I started learning shell since couple of days now and this might be quite basic for all, i want to search for files in a directory containing specific string and replace it with new string. The code i wrote is quite bulky... (2 Replies)
Hi,
I have below directories
Direct 2013-08-12 23123
Direct 2013-08-13 24121
Direct 2013-08-14 34513
Direct 2013-08-31 15435
...........
Direct 2013-09-12 53145
Direct 2013-09-30 65234
Direct 2013-09-30 89642 (11 Replies)
Hi
My directory structure is as below.
dir1, dir2, dir3
I have the list of files to be deleted in the below path as below.
/staging/retain_for_2years/Cleanup/log $ ls -lrt
total 0
drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2
drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies
LEARN ABOUT POSIX
ctime_r
CTIME(P) POSIX Programmer's Manual CTIME(P)
NAME
ctime, ctime_r - convert a time value to a date and time string
SYNOPSIS
#include <time.h>
char *ctime(const time_t *clock);
char *ctime_r(const time_t *clock, char *buf);
DESCRIPTION
For ctime(): The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements
described here and the ISO C standard is unintentional. This volume of IEEE Std 1003.1-2001 defers to the ISO C standard.
The ctime() function shall convert the time pointed to by clock, representing time in seconds since the Epoch, to local time in the form of
a string. It shall be equivalent to:
asctime(localtime(clock))
The asctime(), ctime(), gmtime(), and localtime() functions shall return values in one of two static objects: a broken-down time structure
and an array of char. Execution of any of the functions may overwrite the information returned in either of these objects by any of the
other functions.
The ctime() function need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe.
The ctime_r() function shall convert the calendar time pointed to by clock to local time in exactly the same form as ctime() and put the
string into the array pointed to by buf (which shall be at least 26 bytes in size) and return buf.
Unlike ctime(), the thread-safe version ctime_r() is not required to set tzname.
RETURN VALUE
The ctime() function shall return the pointer returned by asctime() with that broken-down time as an argument.
Upon successful completion, ctime_r() shall return a pointer to the string pointed to by buf. When an error is encountered, a null pointer
shall be returned.
ERRORS
No errors are defined.
The following sections are informative.
EXAMPLES
None.
APPLICATION USAGE
Values for the broken-down time structure can be obtained by calling gmtime() or localtime(). The ctime() function is included for compati-
bility with older implementations, and does not support localized date and time formats. Applications should use the strftime() function
to achieve maximum portability.
The ctime_r() function is thread-safe and shall return values in a user-supplied buffer instead of possibly using a static data area that
may be overwritten by each call.
RATIONALE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
asctime() , clock() , difftime() , gmtime() , localtime() , mktime() , strftime() , strptime() , time() , utime() , the Base Definitions
volume of IEEE Std 1003.1-2001, <time.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 CTIME(P)