find 命令和cp命令结合进行文件筛选操做

在iscc上面看到有关linux赋值相关的命令,挺有意思的,分享一下:linux

find命令

找到path文件夹下的txt文件正则表达式

find [path] -name '*.txt'

而后,使用exec命令,注意这里面的格式
exec command -operator {} \;,这里面的{} \;都不能省,并且{}的意思是前面的find命令返回的结果。shell

copy+find 命令合体

find .\ -name '*.data' -exec  cp {} .\destinationFolder \;

表示把当前目录下的data文件都拷贝到destinationFolder文件夹下。code

5天后的总结
事实上,能够在不用find的前提下搞定,输入cp src_path\*.data dst_path\
over --!!!!字符串


cpio

thinking:如何用cp 文件夹下若干文件到制定文件夹下:file

即cp file1,fil2 to descommand

method:总结

cp [file1-file2].extension  destination

估计啊,[]中是正则表达式吧应该。没错,证实以下:touch

touch a.txt aa.txt
cp [a-z].txt temp/
ls temp (    SHOW a.txt)

这样就证实了是用正则表达式去匹配的。

后来得知,只是linux shell中的一些特性,不能说是每一个字符串都是用正则先处理的。是正则的这个观点,那么说来,也就是错的。

相关文章
相关标签/搜索