Sponsored Content
Top Forums Shell Programming and Scripting Search subdirectories and find and print total files Post 302845969 by blackrageous on Thursday 22nd of August 2013 06:17:02 PM
Old 08-22-2013
Hint: try using -type d option for directory
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search files in a directory and its subdirectories

Hello my friends, I need to write a simple shell bad file :D that search and delete a file it's name 'Microsoft.txt' in the current directory and its subdirectories? So can you help to guide me how i can write this shell, Just give me the beginning :o thank you. (1 Reply)
Discussion started by: Net-Man
1 Replies

2. Shell Programming and Scripting

Find files ignoring subdirectories

Hi guys, I am searching some files not equal to the pattern with this command find ! -name "PATTERN" -type f but my problem is the find command because he also search inside subdirectories and that's the thing i don't want that. Is there any comand to ignore the directories... (4 Replies)
Discussion started by: osramos
4 Replies

3. UNIX for Dummies Questions & Answers

search for files in subdirectories

Hi! I want to find files located in subdirectories. I have tried ls -R | grep myfile but this won't tell me where the file is, only that it is there. Any one have a better idea? Thanks, --Euclid (3 Replies)
Discussion started by: euclid3628800
3 Replies

4. Shell Programming and Scripting

How to find files only inside the subdirectories only?

Hi I have a directory with two subdirectories and also have a code like below to search files modified in last 2 minutes. # ls hello080909.txt inbox outbox # find . -type f -mmin +2 ./inbox/hello2080909.txt ./outbox/hi0080909.txt ./hello080909.txt The above code just searches and... (3 Replies)
Discussion started by: Tuxidow
3 Replies

5. Shell Programming and Scripting

Search and find total count from multiple files

Please advice how can we search for a string say (abc) in multiple files and to get total occurrence of that searched string. (Need number of records that exits in period of time). File look like this (read as filename.yyyymmdd) a.20100101 b.20100108 c.20100115 d.20100122 e.20100129... (2 Replies)
Discussion started by: zooby
2 Replies

6. Shell Programming and Scripting

Find *.tar files under all subdirectories

Hi there, I'm new to shell scripting... I've a situation like to find *.tar files under all subdirectories in "/home/abcd" and i used the below, find /opt/lhapp ! -name "temp" | more the above works fine.. Now don't need search few direcotries like "/home/abcd/aaaa",... (15 Replies)
Discussion started by: skcvasanth
15 Replies

7. UNIX for Dummies Questions & Answers

Command for total number of files (and size) across subdirectories?

Hi all... I have a directory called dbrn. This directory contains an unknown number of subdirectories which in turn contain an unknown number of files. What I want to know is: How many files with extention .ABC can be found in /dbrn across all subdirecties, and what is the total size for... (9 Replies)
Discussion started by: Beun
9 Replies

8. Shell Programming and Scripting

Find command to search files in a directory excluding subdirectories

Hi Forum, I am using the below command to find files older than x days in a directory excluding subdirectories. From the previous forums I got to know that prune command helps us not to descend in subdirectories. Though I am using it here, not getting the desired result. cd $dir... (8 Replies)
Discussion started by: jhilmil
8 Replies

9. UNIX for Dummies Questions & Answers

Use ls or find for search of subdirectories?

(5 Replies)
Discussion started by: jhsinger
5 Replies
findcon(1)						      General Commands Manual							findcon(1)

NAME
findcon - SELinux file context search tool SYNOPSIS
findcon FCLIST [OPTIONS] [EXPRESSION] DESCRIPTION
findcon allows the user to search for files with a specified context. Results can be filtered by object class as described below. FCLIST
The findcon tool operates upon a file context list source. There are three valid file context lists. directory If FCLIST is a name of a directory then begin the search at that directory and recurse within it. Be sure there are no circular mounts within it. file_contexts If FCLIST is the name of a file_contexts file (e.g., /etc/selinux/strict/contexts/files/file_contexts) then open that file and find matching entries. database If FCLIST is the name of a database as created by a previous run of indexcon or apol then open the database and execute queries into it. EXPRESSION
The following options allow the user to specify which files to print. A file must meet all specified criteria. If no expression is pro- vided, all files are printed. -t TYPE, --type=TYPE Search for files with a context containing the type TYPE. -u USER, --user=USER Search for files with a context containing the user USER. -r ROLE, --role=ROLE Search for files with a context containing the role ROLE. -m RANGE, --mls-range=RANGE Search for files with a context with the MLS range of RANGE. Note that findcon ignores the SELinux translation library, if present. In addition, this flag is ignored if the FCLIST has no MLS information. --context=CONTEXT Search for files matching this partial context. This flag overrides -t, -u, -r, and -m. -p PATH, --path=PATH Search for files which include PATH. -c CLASS, --class=CLASS Search only files of object class CLASS. OPTIONS
The following additional options are available. -R, --regex Search using regular expressions instead of exact string matching. This option does not affect the --class flag. -h, --help Print help information and exit. -V, --version Print version information and exit. PARTIAL CONTEXT
The --context flag specifies a partial context, which is a a colon separated list of user, role, and type. If the system supports MLS, the context may have a fourth field that gives the range. If a field is not specified or is the literal asterisk, then the query will always match the field. OBJECT CLASSES
Valid object class strings are block, char, dir, fifo, file, link, or sock. NOTE
The findcon utility always operates on "raw" SELinux file contexts. If the system has an installed translation library (i.e., libsetrans), those translations are ignored in favor of reading the original contexts from the filesystem (if FCFILE is a directory). EXAMPLES
findcon . Find every context in the current directory and all of its subdirectories. findcon -u user_u . Find every context whose user is user_u in the current directory and all subdirectories. findcon -u system_u -t bin_t file_contexts Find entries user system_u and type bin_t within a file_contexts file, assuming that file_contexts is a file contexts file. findcon --context=system_u::bin_t file_contexts This is equivalent to the previous example. findcon --context=system_u:*:bin_t:* file_contexts This is also equivalent to the above example. AUTHOR
This manual page was written by Jeremy A. Mowery <jmowery@tresys.com>. COPYRIGHT
Copyright(C) 2003-2007 Tresys Technology, LLC BUGS
Please report bugs via an email to setools-bugs@tresys.com. SEE ALSO
replcon(1), indexcon(1) findcon(1)
All times are GMT -4. The time now is 07:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy