当前位置: 首页 > news >正文

c 网站开发案例代码网站建设培训总结

c 网站开发案例代码,网站建设培训总结,柳州市建设中心网站首页,wordpress 找回密码最近有这样一个需求#xff0c;删掉某目录下的一些文件夹。其实就是名为“CVS”的文件夹#xff0c;用过CVS的人都知道#xff0c;CVS会在目录的每一级建立一个名为CVS的文件夹#xff0c;里面放着CVS相关信息#xff0c;我需要将某目录下所有的名为“CVS”的文件夹删掉。… 最近有这样一个需求删掉某目录下的一些文件夹。其实就是名为“CVS”的文件夹用过CVS的人都知道CVS会在目录的每一级建立一个名为CVS的文件夹里面放着CVS相关信息我需要将某目录下所有的名为“CVS”的文件夹删掉。在Linux下其实很简单使用find命令 [plain] view plaincopy find . -name CVS -exec rm -rf {} \;   看似没问题但却报错了 [plain] view plaincopy find: ./CVS: No such file or directory   检查了下发现其实./CVS这个文件夹确实存在而且此时已经被删掉了算是功德圆满但是为什么还报错 没办法记得find完成这种功能还有一种写法 [plain] view plaincopy find . -name CVS -exec rm -rf {} \   抱着试试的态度令人意外的是这种方式成功执行并未报任何错误这就叫人疑惑了没办法只好求助于男人man -exec command ;Execute  command;     true  if 0 status is returned.     All followingarguments to find are taken to be arguments to the command untilan  argument  consisting of ; is encountered.  The string {}is replaced by the current file name being processed  everywhereit occurs in the arguments to the command, not just in argumentswhere it is alone, as in some versions of find.  Both  of     theseconstructions might need to be escaped (with a \) or quoted toprotect them from expansion by the shell.     See the EXAMPLES sec-tion  for examples of the use of the -exec option.   The speci-           fied command is run once for each matched file.The command  isexecuted    in  the     starting  directory.     There are unavoidablesecurity problems surrounding  use  of  the  -exec  option;  youshould use the -execdir option instead. 另外一种 -exec command {}           This  variant  of the -exec option runs the specified command on           the selected files, but the command line is built     by  appending           each  selected file name at the end; the total number of invoca-           tions of the command will     be  much  less     than  the  number  of           matched  files.    The command line is built in much the same way           that xargs builds its command lines.  Only one instance of  {}           is  allowed  within the command.    The command is executed in the           starting directory. 看了半天我注意到他们的区别红字体标注。 也就是说 -exec ; 为每一个匹配的文件都执行了一次命令具体到此处就是 rm -rf 命令而 “-exec” 只是把匹配的文件名作为命令的参数append到命令后面即是这样 rm -rf file1 file2 file3 可是这种差别为什么会导致如此明显的差异呢 想了想, 悟到了 #1的执行过程应该是这样 1.  记录并遍历当面层的所有目录和文件并对比是否匹配。 2.  匹配了名为CVS的文件夹然后执行了命令 rm -rf ./CVS,  3. 根据之前的记录多所有目录进行递归遍历此时问题出现当程序试图进入该层名为“CVS”的目录进行遍历是发现此目录不存在所以报错。为什么这个目录没了哈在第二步已经被删掉了 是这样吗: 可以验证 [plain] view plaincopy find . -maxdepth 1 -name CVS -exec rm -rf {} \;   -maxdepth 参数指明匹配只发生在当前目录并不深入子目录 结果是这个命令没有报错也验证了之前的猜想。 在此记录以备后查。
http://www.zqtcl.cn/news/227838/

相关文章:

  • 跟老外做网站网络系统管理与维护机考
  • 网站推广方案范例江西南昌小程序开发
  • 烘焙类网站开发时代背景ppt素材模板免费下载
  • 如何制作多网页网站广州品牌seo推广
  • 域名怎么解析到网站什么是asp网站
  • 网站开发的税率做网站文案
  • 网站模板上传工具如何介绍自己设计的网页
  • 河北网站建设价格低国内做外单的网站有哪些
  • wordpress Apache升级优化营商环境的意义
  • 单页式网站系统wordpress自定义字段怎么用
  • 南宁网站设计要多少钱修改wordpress中的 功能 小工具
  • 南昌高端网站开发费用表域名价格排行
  • 怎么接网站开发外包中国观鸟记录的网站架构
  • 青海省住房和城乡建设厅的官方网站网站举报能不能查到举报人
  • dw做的网站如何上传云服务器网址生成app一键生成器
  • 山西建设厅网站密钥房山营销型网站建设
  • 网站空间多少钱哪里接单做网站
  • 建设部网站资质人员查询页面设计的对称方法包括哪几种形式
  • 滁州网站建设哪个好点iis发布网站无法访问
  • 网站项目建设的定义百度站长平台清退
  • ip开源网站FPGA可以做点什么建设网站的工作职责
  • 重庆微信网站开发公司建设网站技术标准
  • 网站开发浏览器银川市建设诚信平台网站
  • 找合伙人做红木家具网站建设银行员工学习网站
  • iis的默认网站没有自动启动长春小程序开发制作
  • 佛山住房和城乡建设部网站wordpress 英文主题
  • 零食网站策划书厦门建设网站的公司
  • 自己做的网站怎么发布到网上湖南做网站 干净磐石网络
  • steam网站代做设计公司招聘信息
  • 网站开发 书籍无广告自助建站