find: `./folder': No such file or directory

后端 未结 3 477
无人及你
无人及你 2021-01-03 06:28

This is the contents of the directory I\'m working with:

misha@hp-laptop:~/work/c/5$ ls -l
total 8
-rw-rw-r-- 1 misha misha  219 May 20 15:37 demo.c
drwxrwxr         


        
3条回答
  •  -上瘾入骨i
    2021-01-03 06:54

    You can change your find command to this:

    find . -mindepth 1 -not -name demo.c -delete
    
    • -mindepth 1 ensure that you don't select DOT
    • -delete will delete all files and directories

提交回复
热议问题