macos - mac terminal copy command excluding folders
问题描述
In mac catalina, I use this most basic command to copy all files (but not subfolders) of a src directory to dest directory.
cp ~/dirFrom/* ~/dirTo/
In mac catalina, this command works perfectly, but gives this annoying message that it doesn't copy subfolders (of course because -r argument is left out). This is extremely annoying because I have automator shortcut that pops up this message each time it's run... Question is, how do I get this this annoying message to disappear or to specify not to try to copy folders/directories?
superfluous/unnecessary Message that's popped up every time it runs:
The action "Run Shell Script" encountered an error: "cp: /dirFrom/subdir is a directory (not copied)
解决方案
rsync -a -f"- /" -f"+ *" ~/src/ ~/dest
从https://askubuntu.com/questions/632091/how-can-i-exclude-all-subdirectories-but-include-files-of-a-directory-in-rsync复制
推荐阅读
- javascript - Scrollama,改变图表
- java - Apache Flink TaskExecutor 关闭
- kubernetes - Kubernetes cron 作业需要一个命令才能先完成?
- python - Pandas groupby().get_group().size 不返回正确的大小?
- animation - 在 Flutter 中重新创建 crossDissolve 导航
- mobile-safari - PWA 在 POST 上打开 Safari。有没有办法让它不?
- r - 如何在R中的循环内重命名多个文件
- amazon-s3 - CloudFormation 脚本卡在 UPDATE_ROLLBACK_FAILED 中,AWSLambdaInternal 需要 GetObject 权限。如何解决?
- php - WordPress 中的基本 AJAX 测试返回 400 错误
- spring - 登录后显示用户详细信息