![]() ![]() Then there is a further restriction to names that matches filename using -name 'filename'. Then it restricts the names to those of regular files, i.e. This generates a list of all names in the current directory (. If any of them happens to be the name of a directory, then it will be returned along with all further names inside that directory. If these happens to be names of regular files in the current directory, then these will be returned. ![]() You ask find to list every name available under the three paths a, b and c. ![]() You may then restrict the returned names using various tests that may act on the filename, the path, the timestamp, the file size, the file type, etc. The utility takes a number of paths and returns all names beneath these paths. The confusion comes from a misunderstanding of how find works. This will be as quick (or comparably quick) as find | grep filename, but the grep solution would match filename against the full path of each found name, similarly to what -path '*filename*' would do with find. This would look for filename as the name of a regular file anywhere in the current directory or below. I'm assuming that what was actually intended was find. This would obviously be a much slower operation. Would allow find to generate a list of all names from the current directory and below, which grep would then filter. It's a very quick operation, similar to ls filename (but recursive if filename is a directory). Would be quick, because it would just return filename, or the names inside filename if it's a directory, or an error if that name did not exist in the current directory. ![]()
0 Comments
Leave a Reply. |