Just
.
If filename exists, only its modification and access times will be changed. Data will remain the same.
If filename does not exist, a zero-byte file will be created with the current time as the access and modification time.
And if you don't want to modify the access and modification times when the file (a regular file) exists, try:
.
Last edited by elixir_sinari; 02-15-2013 at 02:10 AM..
say i would like to check if the file is existed before i use rm command. How can i do it?
i know if i can use find, but i would like to have a good interface (in a shell script)
thks (3 Replies)
Hello,
I want to check if some word exist or not on some file
By Example :
word is : nixcraft
file called : /root/shell.txt
and i want to check if nixcraft word exist on /root/shell.txt file with if statement or another tool
Any Ideas (5 Replies)
Hi
Does anybody know how I can check if a file exists
i.e. see bellow, this doesn't work by the way and if tried countless variations on this
file1=$one/file111.txt
if
then
echo "Present"
else
echo "Not present"
fi
result :
Not present
(file is already present, eventhough its... (3 Replies)
I have created two scripts, one with hardcoded and another one with extract from file instead of hardcoded,
script:1
--------
#!/bin/ksh
filename="$one/file1.dat"
if
then
echo "$filename has arrived." >> $logfile
else
echo "$filename has NOT yet arrived." >> $logfile
fi
:>
Result:... (4 Replies)
Hi,
I am trying to create a bash script which will check if file exist then remove that file else do nothing. I have to do same process for three files in same script. I have written code for one file and trying to run it.
if
then
rm -r /user1/abc/File1
fi
When I run this code it... (1 Reply)
Hi,
I created following script to check if file exist:
#!/bin/bash
SrcDir=$1
SrcFileName=$2
SrcTimePeriod=$3
if ;then
echo 1
else
echo 0
fi
I ran it like: /apps/Scripts/FileExist.sh /apps/Inbox file1 2nd_period_2010
Even file exist at that location, my above command is... (4 Replies)
HI folks,
can any one tell me how to check whether the file is existed in a directory or not .
let me tell you my requirement : if the file is existed i should display a one message or else i have to send a mail ..
i have the mail logic .. but I'm failed to check file existence .. please... (5 Replies)
Hi All,
Thanks in Advance
I wrote the following code
if
then
echo "version is 1.1"
for i in "subscriber promplan mapping dedicatedaccount faflistSub faflistAcc accumulator pam_account"
do
FILE="SDP_DUMP_$i.csv"
echo "$FILE"
... (5 Replies)
Discussion started by: aealexanderraj
5 Replies
LEARN ABOUT REDHAT
utimes
UTIME(2) Linux Programmer's Manual UTIME(2)NAME
utime, utimes - change access and/or modification times of an inode
SYNOPSIS
#include <sys/types.h>
#include <utime.h>
int utime(const char *filename, struct utimbuf *buf);
#include <sys/time.h>
int utimes(char *filename, struct timeval *tvp);
DESCRIPTION
utime changes the access and modification times of the inode specified by filename to the actime and modtime fields of buf respectively.
If buf is NULL, then the access and modification times of the file are set to the current time. The utimbuf structure is:
struct utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};
In the Linux DLL 4.4.1 libraries, utimes is just a wrapper for utime: tvp[0].tv_sec is actime, and tvp[1].tv_sec is modtime. The timeval
structure is:
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
Other errors may occur.
EACCES Permission to write the file is denied.
ENOENT filename does not exist.
CONFORMING TO
utime: SVr4, SVID, POSIX. SVr4 documents additional error conditions EFAULT, EINTR, ELOOP, EMULTIHOP, ENAMETOOLONG, ENOLINK, ENOTDIR, ENO-
LINK, ENOTDIR, EPERM, EROFS.
utimes: BSD 4.3
SEE ALSO stat(2)Linux 1995-06-10 UTIME(2)