BASH copy all files except one

后端 未结 8 549
逝去的感伤
逝去的感伤 2020-11-30 19:13

I would like to copy all files out of a dir except for one named Default.png. It seems that there are a number of ways to do this. What seems the most effective to you?

相关标签:
8条回答
  • 2020-11-30 19:49
    cp `ls | grep -v Default.png` destdir
    
    0 讨论(0)
  • 2020-11-30 19:54

    rsync has been my cp/scp replacement for a long time:

    rsync -av from/ to/ --exclude=Default.png
    
    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
    -v, --verbose               increase verbosity
    
    0 讨论(0)
提交回复
热议问题