教程复制文件,文件夹链接:链接
手动cp命令:链接
cp -frp /path/to/folder/my_folder_old -T /path/to/folder/my_folder_new
-f, --force
if an existing destination file cannot be opened, remove it
and try again (this option is ignored when the -n option is
also used)
-p same as --preserve=mode,ownership,timestamps
-R, -r, --recursive
copy directories recursively
-T, --no-target-directory
treat DEST as a normal file
Run Code Online (Sandbox Code Playgroud)
虽然如果my_folder_new已经存在,my_folder_old将在第一个内部创建,而不是替换.为什么会这样?
之所以会发生这种情况,是因为my_folder_new已经创建了.执行相同的cp命令,它将看作新路径,/ path/to/folder/my_folder_new /
归档时间: |
|
查看次数: |
6020 次 |
最近记录: |