Wednesday, December 28, 2011

Find all files ending with ".inc" in current folder

Recently I had to do a code review of a particular project. I had to check whether they had exported all the views into code. So I had find for the views export files. So here are the few steps I followed.

To check whether the default_views folder exists or not.

1. Opened my terminal

2. man find

3. Didn't understand much. But enough to write these following commands.






find . -type d -name 'default_views'

find                                =  The command to find files in the linux folder structure
.                                     =  The location to search for. '.' means current folder.
-type d                           =   Search for only directories
-name 'defatult_views'   =  Having name 'default_views'

Then I did a search for all the folders within modules whose name consists of 'views'
find . -type d -name '*views*'

If got no results. So I did a search for all the files that end with inc

find . -type f -name '*.inc'

No comments:

Post a Comment