How do I exclude a folder when performing file operations i.e. cp, mv, rm and chown etc. in Linux

前端 未结 6 1904

How do you exclude a folder when performing file operations i.e. cp etc.

I would currently use the wild card * to apply file operation to all, but I need to exclude one

6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-03 11:47

    find dir_to_start -name dir_to_exclude -prune -o -print0 | xargs -0 chown owner
    
    find dir_to_start -not -name "file_to_exclude"  -print0 | xargs -0 chown owner
    

提交回复
热议问题