Tikejhya: Ashish Nepal

Knowledgebase

Category: Find

find and delete .svn

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

# How to find .svn Directory if any exists
ls `find new -type d -name .svn`

# How to delete all .svn folders in Directory
rm -rf `find new -type d -name .svn`

# Find files named .svn and list.
# -exec with rm would remove in this case.
find . -name .svn -exec echo {} \

Find hidden files

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

find / -xdev ! -type d -name .* | sort

Find and Delete files

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Delete empty file with Max depth 1 i.e. delete only one subdir if its empty

Test with echo
`find /home/ashish/movies -maxdepth 1 -type d -empty -print0|xargs -0 echo rm -rf {} ;`

If Output is right?

`find /home/ashish/movies -maxdepth 1 -type d -empty -print0|xargs -0 -exec rm -rf {} ;`

# Find .gz file under certain directory and delete.
# Find and delete file (linux)

find /var/logs/*/*.gz -print0|xargs -0 -exec echo {} ;
find /var/logs/*/*-2012-08 -maxdepth 1 -type f -empty -print0|xargs -0 -exec echo {} ;

Find and delete

Find and Log Old file (20 Days old) from given location

ls -lrt $(find /home/ashish.nenpal/ * -mtime +20) >> /home/ashish.nepal/oldfile.txt

Find and Delete 20 days Old File from given location

find /home/ashish.nepal/ -mtime +20 -exec rm -f {} ;

Find empty file

Find empty “file” and move to given destination

find path -empty -exec mv '{}' destination -type f ;

Find all type of empty Files and move to given destiation

find path -empty -exec mv '{}' destination ;

Powered by WordPress & Theme by Anders Norén