[PowerShell] 删除某个目录以其子目录下的某些文件 →→→→→进入此内容的聊天室

来自 , 2020-08-12, 写在 PowerShell, 查看 105 次.
URL http://www.code666.cn/view/d7f426cc
  1. #!/bin/bash
  2. # 执行前指定一个目录和正则表达式
  3.  
  4. test $# -ne 2 && echo "Please specify a directory and regex expression" && exit 0
  5.  
  6. FILES=$(find $1 -type f)
  7. for file in $FILES
  8. do
  9.  if [[ ! $file =~ $2 ]]
  10.  then
  11. #          echo "delete $file"
  12.         rm -rfv $file
  13.  fi
  14. done
  15.  
  16.  
  17. //shell/1281

回复 "删除某个目录以其子目录下的某些文件"

这儿你可以回复上面这条便签

captcha