wipedir.sh

来自「Shall高级编程」· Shell 代码 · 共 38 行

SH
38
字号
#!/bin/bashE_WRONG_DIRECTORY=73clear # Clear screen.TargetDirectory=/home/bozo/projects/GreatAmericanNovelcd $TargetDirectoryecho "Deleting stale files in $TargetDirectory."if [ "$PWD" != "$TargetDirectory" ]then    # Keep from wiping out wrong directory by accident.  echo "Wrong directory!"  echo "In $PWD, rather than $TargetDirectory!"  echo "Bailing out!"  exit $E_WRONG_DIRECTORYfi  rm -rf *rm .[A-Za-z0-9]*    # Delete dotfiles.# rm -f .[^.]* ..?*   to remove filenames beginning with multiple dots.# (shopt -s dotglob; rm -f *)   will also work.# Thanks, S.C. for pointing this out.# Filenames may contain all characters in the 0 - 255 range, except "/".# Deleting files beginning with weird characters is left as an exercise.# Various other operations here, as necessary.echoecho "Done."echo "Old files deleted in $TargetDirectory."echoexit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?