当前位置:网站首页>cp强制覆盖与不覆盖拷贝方法
cp强制覆盖与不覆盖拷贝方法
2022-07-30 00:10:00 【帅气的梧桐述】
cp强制覆盖,不用处理cp: overwrite
当我们使用命令cp -r 复制文件或者文件夹的时候,当目标地址中包含有相同的文件时,会提示“cp: overwrite”。
这是因为bash alias设置的alias cp=’cp -i’,也就是说当Linux下输入cp命令实际上运行的是cp -i。通过cp --help查看-i的功能,如下:
[[email protected] cmc]# cp --help
Usage: cp [OPTION]... [-T] SOURCE DEST
or: cp [OPTION]... SOURCE... DIRECTORY
or: cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options too.
-i, --interactive prompt before overwrite (overrides a previous -n
option)
prompt before overwrite,就表示当需要拷贝的目录下有重复文件就会提示overwrite。当重复文件太多此时就比较麻烦。
如下方法解决不再提示:
第一种:在cp命令前加符号“\”
\cp -r directory Destination Path
第二种:直接调用/bin/cp
/bin/cp -r directory Destination Path不覆盖拷贝方法
某些时候在拷贝文件时,可能希望跳过某些已经在目标文件夹中已存在的文件。此时可通过添加-n解决。
cp -rn directory Destination Path边栏推荐
- Reading notes. This is the psychology: see through the essence of the pseudo psychology (version 10)"
- The difference and usage of call, apply and bind
- EA&UML日拱一卒-多任务编程超入门-(9)线程同步
- 关于 byte 的范围
- 读书笔记:《这才是心理学:看穿伪心理学的本质(第10版)》
- EA&UML日拱一卒-多任务编程超入门-(2)进程和线程
- EA&UML日拱一卒-多任务编程超入门-(8)多任务安全的数据类
- 直播平台搭建,设置状态栏颜色
- KDE Frameworks 5.20.0: Plasma welcomes many improvements
- At the age of 29, I was fired from a functional test. Can't find a job after 2 months of interviews?
猜你喜欢
![CesiumJS ^ source read [0] 2022 - article directory and source engineering structure](/img/6a/0a446eb00fb73275897cbfb336e0b0.png)
CesiumJS ^ source read [0] 2022 - article directory and source engineering structure

【集训DAY16】ALFA【凸壳】【计算几何】

全网最强 JVM 来袭!(至尊典藏版)

rk-boot framework combat (1)

First Normal Form, Second Normal Form, Third Normal Form

外包干了五年,废了...

低压差线性稳压器MPQ2013A-AEC1品牌MPS国产替代

KDE Frameworks 5.20.0: Plasma welcomes many improvements

消息中间件解析 | 如何正确理解软件应用系统中关于系统通信的那些事?

Worthington经过使用测试的细胞分离系统方案
随机推荐
第一范式、第二范式、第三范式
The difference and usage of call, apply and bind
头条号自媒体运营:如何在今日头条涨500+粉丝?
Worthington Dissociation Enzymes: Collagenase and Four Basic Profiles
自媒体短视频标题怎么写?3个爆款标题,让你的视频收获更多流量
C陷阱与缺陷 第4章 链接 4.3 命名冲突与static修饰符
2022杭电多校第三场 Two Permutations (dp, 哈希)
Chinese semantic matching
i.MX6U-driver development-3-new character driver
Sentinel入门
外包干了五年,废了...
Worthington木瓜蛋白酶&胰凝乳蛋白酶&脱氧核糖核酸酶 I
Douyin short video traffic acquisition strategy, mastering these will definitely be a hit
“灯塔工厂”的中国路径:智造从点到面铺开
jenkins搭建部署详细步骤
NumPy(二)
C陷阱与缺陷 第5章 库函数 5.2更新顺序文件
c语言小游戏扫雷
Worthington's tried and tested cell isolation system protocols
go语言序列化和反序列化及序列化后的json为空和json的key值大写如何改为小写问题