Shell - move the required files to the specified directory

find . -name '*.ko' | xargs mv -t output/
注:
   从当前目录开始搜索,将所有的ko文件全都搬运到output目录下

Needless to say, the role of find, xargs with pipeline (|) is to execute the command (mv -t .) with the output of the previous command (find) as a command line parameter. The entire pipeline command is roughly equivalent to:

mv -t . 'find . -name '*.ko''


But when xargs is not used, if the result of find is too many, it may cause too many arguments error. With xargs, xargs will automatically handle this situation. When find output is too long, xargs will automatically be divided into multiple commands.

mv -t . files


The role is to move the files to the current (.)

Guess you like

Origin blog.csdn.net/Ivan804638781/article/details/106255672