Sponsored Content
Operating Systems Linux SuSE Regarding Readable check for all the files in the folder Post 302282008 by angheloko on Friday 30th of January 2009 02:18:56 AM
Old 01-30-2009
Are trying to see if the file has read permissions?

Code:
ls -l | grep ".r..r..r.."

will display files with read permission for owner,group and others

Edit:

You're getting the "readable" files...

Code:
ls | while read f; do
[ -r $f ] && echo "file is readable"
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script that would check if the CD-rom is readable

Hi, I was wondering if there's a command in Linux that would check to see if a CD is inserted into CD-rom. I am developing a shell script that would copy a file from CD rom. For this, I have to first verify if the CD has been inserted or not. Can anyone help me? Thanks, Sundeep (1 Reply)
Discussion started by: eamani_sun
1 Replies

2. Shell Programming and Scripting

HOW TO CHECK ONLY .C FILES EXISTS OR NOT IN A FOLDER using IF in C shell script?

Hi friends.. I hav a problem.... I dont know how to check .c files exists r not in a folder using IF in C shell script actually i tried like this if(=~ *.c) even though some .c files or there in the current folder..it is not entering int o the if control statement...... (17 Replies)
Discussion started by: p.hemadrireddy
17 Replies

3. Shell Programming and Scripting

check how many files in folder or total files in folder

Hi all, I have copied all my files to one folder.and i want to check how many files (count) in the folder recently moved or total files in my folder? please send me the query asap. (3 Replies)
Discussion started by: durgaprasad
3 Replies

4. Shell Programming and Scripting

check whether file is readable or not in ksh

i want to check the readability of a file inside the script. when i use if then echo the file "$sourcef" is not readable else echo something fi i am getting the error : f: unknown test operator when i tried to check the availability with if i was... (3 Replies)
Discussion started by: gotam
3 Replies

5. Shell Programming and Scripting

How to check if a file is not readable by anyone except the owner?

All, I have a script where I get a filename as input and do some processing with the file that I got as input. Requirement: Now I have a requirement where I need to check the following: If either of this goes wrong, the script should pop out a warning message. I tried searching the... (6 Replies)
Discussion started by: bharath.gct
6 Replies

6. Shell Programming and Scripting

check if file is readable by others

hi all, in ksh script how do i detect if a file is readable by others ?? thanks. (6 Replies)
Discussion started by: cesarNZ
6 Replies

7. Shell Programming and Scripting

check existence of files in a folder

Hi I am having a problem to verify existence of files. I need to know whether or not files in a folder that begins with a name. For example all files that start with The_File_ *. I was doing it this way, but gives me error. if text -f /work/The_File_* then ... else .. fi (5 Replies)
Discussion started by: Rodrih92
5 Replies

8. Shell Programming and Scripting

Making wtmp files readable one at a time

New Unix user/scripter here. Been trying to solve a problem for two days now with no luck. Hoping someone here has an answer. Essentially I have a list of wtmp files which I have decompressed and copied to a temporary directory. Using the following command I can turn them into a file than can... (4 Replies)
Discussion started by: Stryfe16
4 Replies

9. Shell Programming and Scripting

How to check in a folder all files which doesnt have the specifc string?

I have a folder with 100s of dat files, with delimiter "|", in some files they didn't provide this delimiter. how to automatically check those list of files in a folder which doesnt have a delimiter or string this way "|" is it possible? Thank you very much for the helpful info. (3 Replies)
Discussion started by: cplusplus1
3 Replies

10. Shell Programming and Scripting

When comparing binary files, show human readable result?

Hello. I am comparing two binary file. The first file is the source file. The second file is a modified version of the first one. Modification concern uuid value. Example first file have multiple occurrences of 69a3604b-ac2b-43b7-af84-0a4a67fc6962 second file have the same occurence... (1 Reply)
Discussion started by: jcdole
1 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 11:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy