The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Excluding directories with find x96riley3 UNIX for Dummies Questions & Answers 3 04-08-2009 04:12 AM
Finding Hidden files and protecting the folder containing hidden files from deletion pochaw Shell Programming and Scripting 4 12-22-2007 01:33 AM
search for files excluding binary files user_prady Shell Programming and Scripting 2 09-05-2007 12:18 AM
Excluding files using tar cXzf sampipe UNIX for Dummies Questions & Answers 11 07-28-2005 09:46 AM
Excluding Old Files on AWK !!! alexalvarenga Shell Programming and Scripting 2 01-16-2002 10:25 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-25-2008
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 255
find excluding the hidden files

Hi ,

I am trying to use the find command with delete in a directory . Even though i use a wil character search the find command is checking the hidden files which inturn results in error .

Can i avoid look that into the hidden files ?? I am using HP unix .

find /cv1/ -name "ite*" -mtime +14 -exec rm -f -r

HIw can modify the above command so that i exclude the hedden files or directory when searching ..

PLease let me know if is urgent

Thanks,
Arun
  #2 (permalink)  
Old 01-26-2008
shamrock shamrock is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2007
Location: USA
Posts: 750
Question

Quote:
Originally Posted by arunkumar_mca View Post
Hi ,

I am trying to use the find command with delete in a directory . Even though i use a wil character search the find command is checking the hidden files which inturn results in error .

Can i avoid look that into the hidden files ?? I am using HP unix .

find /cv1/ -name "ite*" -mtime +14 -exec rm -f -r

HIw can modify the above command so that i exclude the hedden files or directory when searching ..

PLease let me know if is urgent

Thanks,
Arun
Check the syntax of the find command. It is missing the curly braces {} that represent the files returned by find and it should be terminated by an escaped semi-colon \;

Code:
find /cv1/ -name "ite*" -mtime +14 -exec rm -fr {} \;
I am not sure what you mean by hidden files or directories?
  #3 (permalink)  
Old 01-26-2008
lucaswoods lucaswoods is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 9
He means files prepended with a period, .hidden for example.

You can use a regex to exclude these files and directories:

find . \( ! -regex '.*/\..*' \)
  #4 (permalink)  
Old 01-27-2008
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 255
Hi

find /wsfer/cre/ -name "mod*" -mtime +14 -exec rm -f -r 2> /dev/null "{}" ";"

This was the command i used the syntax was right ..
I even though tried the regex you suggested it was not working . I am using HP UNIX.

Even though i used /dev/null after this command when i tried $? the status i am geeting is 1 if the permision denied . Why it is happening .
And how to exclude the hidden files and directory in the above command . Please help.

Thanks
Arun.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0