Solaris UNIX Case-Insensitive Find File Search

www.lau‮c.irutt‬om
Solaris UNIX Case-Insensitive Find File Search

To perform a case-insensitive file search on Solaris or OpenSolaris, you can use the find command with the -iname option.

For example, to search for files with the name file.txt in the current directory and all its subdirectories, ignoring case, you can use the following command:

find . -iname "file.txt"

This will find all files with the name file.txt, regardless of the case of the letters in the name. The . indicates that the search should start in the current directory.

You can also use the -name option to perform a case-sensitive search. For example:

find . -name "file.txt"

This will only find files with the name file.txt where the case of the letters in the name is exactly as specified.

You can use additional options with find to narrow your search. For example, to search for files with the name file.txt that are regular files (not directories), you can use the -type f option:

find . -iname "file.txt" -type f

You can also use the -exec option to execute a command on the files that are found. For example, to delete all files with the name file.txt, ignoring case, you can use the following command:

find . -iname "file.txt" -exec rm {} \;

This will find all files with the name file.txt and delete them.

Note: These commands require root privileges to execute if you are searching directories that you do not have permission to access.

Created Time:2017-10-30 14:27:19  Author:lautturi