//
you're reading...
Linux Command

Linux ‘find’ command and example (keep add on)

Linux ‘find’ command and example

Find all .xml files in the target folder and tar into one .gz file

find /target_folder -mtime +5 -name "*.xml" -type f -exec tar -cvf temp_log_xml.tar {} \;

Find all .xml files created 5 days ago in the target folder and delete it

find /target_folder -mtime +5 -name "*.xml" -type f -exec rm -f {} \;

Delete all audit files by use following coomand to avoid the error ‘/bin/rm: cannot execute [Argument list too long]’

find /targetFolder -name "*.aud" -print | xargs rm

Advertisements

About daviewning

I am an Oracle DBA

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: