Need help in excluding a particular directory using Find commad


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need help in excluding a particular directory using Find commad
# 1  
Old 05-17-2010
Need help in excluding a particular directory using Find commad

Hi,

I have a directory structure as below

/home/gad/Merl/a/a1.txt
/home/gad/Merl/b/a1.txt
/home/gad/Merl/c/a1.txt

How can I find the file a1.txt but not from directory 'a' and it(the filw) should loaded 6 days ago..

Can any one pls help,quick reply much appriciated..

Thanks.
# 2  
Old 05-18-2010
Assuming modified, instead of loaded:

Code:
find  . -type d -name a -prune -o -name a.txt -mtime 6 -print

If you don't want exactly 6 day ago, but at least 6 days ago:

Code:
find  . -type d -name a -prune -o -name a.txt -mtime +5 -print

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find file with extension and excluding directory

Hi, I have an inquiry on how do I use the find command in Solaris Unix to find some file ends with extension : txt, err in the root directory with modified date of 30days and this find command will also need to exclude b directory and its subdirectory. All the files from the above find criteria... (5 Replies)
Discussion started by: snowfrost88
5 Replies

2. Shell Programming and Scripting

Find/searching files in subdirectories excluding the fiels in Parent Directory

Hi All, requirement is to find and remove the files from sub directories but it should exclude the files from parent directory. At present i am using the below one but it finds and remove files from both parent and sub directories. find ${PATH} -type f \( -name securitas\* -o -name \*gz... (1 Reply)
Discussion started by: Naveenkk
1 Replies

3. UNIX for Advanced & Expert Users

Find all files in the current directory excluding hidden files and directories

Find all files in the current directory only excluding hidden directories and files. For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided. `find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Discussion started by: ksailesh1
7 Replies

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

5. Shell Programming and Scripting

Excluding a directory

i want to search files in public_html of all users and exclude any directories named "uploads" or "albums" (because there are many files in these), just skip them completely now im doing something like find /home/*/public_html -regex ".*\(php\|html\|htm\)$" -path albums -prune -o -type f... (1 Reply)
Discussion started by: vanessafan99
1 Replies

6. Shell Programming and Scripting

Excluding directory during deleting

Hi all, I'm trying to work on a script to delete files older then 31 day's in certain directories. Now, that works, but in one directory there are 3 other maps which contains files that can be deleted but one map which contains files that can't be deleted. My current command is: find... (6 Replies)
Discussion started by: JasperG
6 Replies

7. Shell Programming and Scripting

Find all files for a user, excluding a directory

I have been searching, and cannot find an answer for this. I am trying to find all files for a user, lets call him (test001), and I want to exclude a specific directory. Here is the command I run, it finds all files: find / -user test001 I get this result: > find / -user test001 ... (4 Replies)
Discussion started by: steve2x4
4 Replies

8. UNIX for Dummies Questions & Answers

Find Files in a Directory Excluding Subdirectories

Hi, I have a filename Location.txt in a directory /abc. Similar name file is present in its subdirectory /abc/xyz. I want to find the file which is present only in /abc and not in /abc/xyz. Please any1 of u can provide a quick suggestion. Its very urgent. Thanks, Amol (2 Replies)
Discussion started by: Amol_Dicholkar
2 Replies

9. UNIX for Advanced & Expert Users

find excluding a directory and a file

Hi I have some 5 folders and two files in the current directory. I want to delete all, expect one folder(files in the folder too should not be deleted) and a file in the current directory. Lets say the folder and file that should not be deleted as 'a'(folder name) and 'b'(file name). Can you... (1 Reply)
Discussion started by: ammu
1 Replies

10. Filesystems, Disks and Memory

Commad to Delete Nested Directory

Can someone please tell me the command to delete a NESTED DIRECTORY. here is my email address: firewalls007@hotmail.com (2 Replies)
Discussion started by: Javed Akram
2 Replies
Login or Register to Ask a Question