Using find - Deleting all files/directories (in Linux ) except any one

后端 未结 11 1059
野趣味
野趣味 2021-02-02 15:12

If we want to delete all files and directories we use, rm -rf *.

But what if i want all files and directories be deleted at a shot, except one particular fi

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-02 16:02

    At least in zsh

    rm -rf ^filename
    

    could be an option, if you only want to preserve one single file.

提交回复
热议问题