Home > Article > System Tutorial > Imitate the myfind command in the unix operating system to implement a myfind
Imitate the find command in the unix operating system and implement a myfind command. The myfind command starts from the specified directory and searches for the specified file recursively. The command format is as follows: myfindPATH-option parameter [-print][-exec command {};]PATH: starting directory to search. -option parameter: Used to control the search method, the details are as follows (only the ones I commonly use are given below): -name "file": Specify the file name to be searched The linux command locates the file , which can be escaped?* wait. -prune directory: Do not search this directory when emphasizing search. -mtime n or -n: Search linux command location files by time, n: indicates files that were changed n days ago; -n: indicates files that were changed between last night and n days ago. -ctime n or -n: also searches by time, n: indicates files created n days ago; -n: indicates files created between last night and n days ago. -print: Output search results to standard output. Optional Experiment 1: Implement the -exe option. -exec: Execute the specified program for each result found. The format is as follows: -exec program name Tip: Executing the specified program can create a process to perform optional experiment 2: Change the myfind command you implemented to use multi-threading. Compare the execution results, efficiency and other linux deletion commands between the multi-threaded implementation of myfind and the single-threaded implementation of myfind, and give your explanation in the experiment report.
The above is the detailed content of Imitate the myfind command in the unix operating system to implement a myfind. For more information, please follow other related articles on the PHP Chinese website!