Doing a month to day conversion with wrong syntax.
Not sure what the use of all_files variable, later checking and storing if the filename is older than retention, which is dependent on incorrect value of period.
Then checking if nonempty filename exist greater than retention then store some info in file else store some other info in additional files. Do you need log of what files were deleted ?
There is no code to delete the obsolete file.
once the script displays right results replace ls {} with rm {}
This User Gave Thanks to 47shailesh For This Post:
Hi,
I'm the new user of linux/unix. Can I ask that anybody know how to use the linux/unix shortcut key to search a specific file from a list of directory?
For example, I know the file name that I want to search. But I forget which directory or location is my desired file put.Got any shortcut... (7 Replies)
I have to search a file in a prticular directory. filename will be passed through command line. The directory may contain subdirectory.
i.e.
suppose directory in /u03/appl (it can hard coded in script). This directory may contain subdirectory.
$ scriptname.sh filename
output should be... (2 Replies)
Hi Guys,
I want to search the content of all the files (of a particular type like .txt)
in a directory for a specific string pattern. Can anyone help me?
Thanks (7 Replies)
Hi all,
I have 2 files, One file contain data like this
FHIT
CS
CHRM1
PDE3A
PDE3B
HSP90AA1
PTK2
HTR1A
ESR1
PARP1
PLA2G1B
These names are mentioned in the second file(Please see attached second file) as
# Drug_Target_X_Gene_Name:(Where X can be any number (1-1000) (1 Reply)
Hi all,
I have 2 files, One file contain data like this
FHIT
CS
CHRM1
PDE3A
PDE3B
HSP90AA1
PTK2
HTR1A
ESR1
PARP1
PLA2G1B
These names are mentioned in the second file(Please see attached second file) as (7 Replies)
I am trying to do the following task :
export ENV=aaa
export ENV_PATH=$(cd /apps | ls | grep $ENV)
However, it's not working. What's the way to change to directory and search some file in that directory in single command
Please help. (2 Replies)
Hi,
I have log file which rolls out every second which is as this.
HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
I need a script which should watch a directory for a file with specific directory.
If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column.
The file should be moved to another directory and the a... (8 Replies)
Hi,
Is there any way to use find command and search only specific subdirectories in a directory.
for example
/home/d1
/home/d2
/home/d3
i want to search in the following directories
/home
/home/d1
/home/d2
i do not want the find command to search the /home/d3 directory. (6 Replies)
Discussion started by: Little
6 Replies
LEARN ABOUT OSF1
access
access(2) System Calls Manual access(2)NAME
access - Determines the accessibility of a file
SYNOPSIS
#include <unistd.h>
int access (
const char *path,
int access_mode) ;
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
access(): XPG4, XPG4-UNIX
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to the file pathname. When the path parameter refers to a symbolic link, the access() function returns information about the file
pointed to by the symbolic link.
Permission to access all components of the path parameter is determined by using a real user ID instead of an effective user ID, and
a group access list (including a real group ID) instead of an effective group ID. Specifies the type of access. The bit pattern
contained in the access_mode parameter is constructed by a logical OR of the following values: Checks read permission. Checks write
permission. Checks execute (search) permission. Checks to see if the file exists.
DESCRIPTION
The access() function checks for accessibility of the file specified by a pathname.
Only access bits are checked. A directory may be indicated as writable by access(), but an attempt to open it for writing will fail
(although files may be created there); a file's access bits may indicate that it is executable, but the execve() function can fail if the
file does not contain the proper format.
RETURN VALUES
Upon successful completion, the access() function returns value of 0 (zero). Otherwise, a value of -1 is returned and errno is set to
indicate the error.
ERRORS
If the access() function fails, access to the file specified by the path parameter is denied and errno may be set to one of the following
values: Permission bits of the file mode do not permit the requested access, or search permission is denied on a component of the path pre-
fix. The owner of a file has permission checked with respect to the ``owner'' read, write, and execute mode bits, members of the file's
group other than the owner have permission checked with respect to the ``group'' mode bits, and all others have permissions checked with
respect to the ``other'' mode bits. The path parameter points outside the process' allocated address space. The pathname contains a char-
acter with the high-order bit set. An I/O error occurred while reading from or writing to the file system. Too many symbolic links were
encountered in translating the pathname. A component of a pathname exceeded PATH_MAX characters, or an entire pathname exceeded NAME_MAX
characters. The named file does not exist or is an empty string. A component of the path prefix is not a directory. Write access is
requested for a file on a read-only file system.
RELATED INFORMATION
Functions: chmod(2), stat(2)
Standards: standards(5) delim off
access(2)