Regarding Readable check for all the files in the folder


 
Thread Tools Search this Thread
Operating Systems Linux SuSE Regarding Readable check for all the files in the folder
# 1  
Old 01-30-2009
Regarding Readable check for all the files in the folder

Currently we are doing the migration to unix to linux.
I am facing the new problem

kganeshb@its04489:~/scripts $ ls -l | more
total 340
-rw-r----- 1 kganeshb users 9038 Oct 22 13:23 109_db.txt
-rw-rw---- 1 dlc users 1413 Oct 10 17:40 1.txt
-rw-rw---- 1 kganeshb users 45 Jan 28 13:46 a
-rw------- 1 kganeshb users 197 Dec 26 13:19 aa
-rw-rw---- 1 kganeshb users 99 Jan 28 13:37 aaa
-rw-rw---- 1 kganeshb users 110 Jan 28 12:29 aaa.sh
-rw-r--r-- 1 kganeshb users 11146 Sep 29 15:36 aat.txt
-rw-rw---- 1 kganeshb users 58 Dec 29 19:03 aa.txt
-rw-rw---- 1 kganeshb users 639 Jan 8 11:48 add.sh

My script
if [ -r * ]
then
echo "read"
else
echo "non read"
fi

output
bash: [: too many arguments
non readable

Our most of the script using the -r * option.
# 2  
Old 01-30-2009
Are trying yo 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
# 3  
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

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question