Monday, November 18, 2019

Find all files with name containing string

Find all files with name containing string

EmailThis Premium lets you save unlimited bookmarks, PDF, DOCX files, PPTs and images. It also gives you a PDF copy of every page that you save. Upgrade to Premium →
find $HOME -name "hello.c" -print 

This will search the whole $HOME (i.e. /home/username/) system for any files named "hello.c" and display their pathnames:

/Users/user/Downloads/hello.c /Users/user/hello.c 

However, it will not match HELLO.C or HellO.C. To match is case insensitive pass the -iname option as follows:

find $HOME -iname "hello.c" -print 

Sample outputs:

/Users/user/Downloads/hello.c /Users/user/Downloads/Y/Hello.C /Users/user/Downloads/Z/HELLO.c /Users/user/hello.c 

Pass the -type f option to only search for files:

find /dir/to/search -type f -iname "fooBar.conf.sample" -print find $HOME -type f -iname "fooBar.conf.sample" -print 

The -iname works either on GNU or BSD (including OS X) version find command. If your version of find command does not supports -iname, try the following syntax using grep command:

find $HOME | grep -i "hello.c" find $HOME -name "*" -print | grep -i "hello.c" 

OR try

find $HOME -name '[hH][eE][lL][lL][oO].[cC]' -print 

Sample outputs:

/Users/user/Downloads/Z/HELLO.C /Users/user/Downloads/Z/HEllO.c /Users/user/Downloads/hello.c /Users/user/hello.c 

Source: https://stackoverflow.com/questions/11328988/find-all-files-with-name-containing-string/11329012

Please check the attached file.

EmailThis was not able to extract useful content from the website. Hence, we have saved the webpage to a PDF file. You can find that attached along with this email.

Upgrade to Premium Plan

✔ Save unlimited bookmarks.

✔ Save PDFs, DOCX files, images and Excel sheets as email attachments.

✔ Get priority support and access to latest features.

Upgrade to Premium

No comments: