Sponsored Content
Full Discussion: File existence problem
Top Forums UNIX for Dummies Questions & Answers File existence problem Post 302073546 by anormal on Monday 15th of May 2006 12:54:08 PM
Old 05-15-2006
Thank you so much Perderabo. It's ok now..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File existence

Hey all, I have total new with shell scripting so I don't know if what I need to do even possible, here it is...for a duration of time (say...1 hour) I need to check for the existence of a particular file, if it exists then I will invoke a java program or I will continue to check until a)... (2 Replies)
Discussion started by: mpang_
2 Replies

2. Shell Programming and Scripting

File existence using ls

Hi I want to check a particular file is available or not. But i know only the pattern of that file sat AB1234*.txt.I need the latest file name and it ll be used in the script. How can i do this using ls -ltr command. Thanks, LathishSundar V (2 Replies)
Discussion started by: lathish
2 Replies

3. Shell Programming and Scripting

Facing problem in checking the directory existence

Hi All, I have a written a scell script which checks the existence of a directory. The dierctory name is read from property file. Though the dierctory exists but it says - it does not exist-- Find my code below -- #! /bin/ksh #Tibco Properties file is inclusion .... (5 Replies)
Discussion started by: supriyabv
5 Replies

4. Shell Programming and Scripting

Test for a file existence

deleted (1 Reply)
Discussion started by: ust
1 Replies

5. Shell Programming and Scripting

Parse file from remote server to calculate count of string existence in that file

Hi I need to parse the file of same name which exist on different servers and calculate the count of string existed in both files. Say a file abc.log exist on 2 servers. I want to search for string "test" on both files and calculate the total count of search string's existence. For... (6 Replies)
Discussion started by: poweroflinux
6 Replies

6. UNIX for Dummies Questions & Answers

To check for existence of a file

I need to check for the existence of a file *.log in a specific directory using a perl script. Presently am not in that particular directory. So i am using chdir ("/path/to/my/file) And then i am using the -e in an if statement to check if it exists. if (-e $File) {......} $File contains the... (1 Reply)
Discussion started by: manutd
1 Replies

7. Shell Programming and Scripting

File existence

Hi I'm using the below command in shell script to check for file exists in the path if ..... fi path and test are variables path and the file exists but the commands inside if condition is executed (! operator used) Is the above way of checking for file existence is correct? ... (4 Replies)
Discussion started by: vinoth_kumar
4 Replies

8. Shell Programming and Scripting

Script to check for the file existence, if file exists it should echo the no of modified days

Hi, I am looking for a shell script with the following. 1. It should check whether a particular file exists in a location #!/bin/sh if ; then echo "xxx.txt File Exists" else echo "File Not Found" fi 2. If file exists, it should check for the modified date and run a command... (2 Replies)
Discussion started by: karthikeyan_mac
2 Replies

9. Shell Programming and Scripting

File existence error

I'm trying to verify the existence of a file. cd /usr/local/bin old_boing=`grep -l $old_inst *` new_boing=boing-$new_ver print "NEW BOING $new_boing" print "OLD BOING $old_boing" if ];then print "There was no boing" else print "boing exist" fi I know there is... (3 Replies)
Discussion started by: radicaled
3 Replies

10. Shell Programming and Scripting

File existence

Hope someone can help me on this In a directory ,files are dynamically generated.I need a script to do the following if files are not received for more than 2 hours or if the received file is empty then do something How can I put that in a script.Thank you eg. in cd /dir_name the... (13 Replies)
Discussion started by: haadiya
13 Replies
POSIX_ACCESS(3) 							 1							   POSIX_ACCESS(3)

posix_access - Determine accessibility of a file

SYNOPSIS
bool posix_access (string $file, [int $mode = POSIX_F_OK]) DESCRIPTION
posix_access(3) checks the user's permission of a file. PARAMETERS
o $file - The name of the file to be tested. o $mode - A mask consisting of one or more of POSIX_F_OK, POSIX_R_OK, POSIX_W_OK and POSIX_X_OK. POSIX_R_OK, POSIX_W_OK and POSIX_X_OK request checking whether the file exists and has read, write and execute permissions, respectively. POSIX_F_OK just requests checking for the existence of the file. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 posix_access(3) example This example will check if the $file is readable and writable, otherwise will print an error message. <?php $file = 'some_file'; if (posix_access($file, POSIX_R_OK | POSIX_W_OK)) { echo 'The file is readable and writable!'; } else { $error = posix_get_last_error(); echo "Error $error: " . posix_strerror($error); } ?> NOTES
Note When safe mode is enabled, PHP checks whether the files or directories being operated upon have the same UID (owner) as the script that is being executed. SEE ALSO
posix_get_last_error(3), posix_strerror(3). PHP Documentation Group POSIX_ACCESS(3)
All times are GMT -4. The time now is 10:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy