Pwd*_*wdr 7 bash shell terminal symlink copy
我想递归复制包含符号链接(符号链接)以及带有 Bash/Shell 脚本的普通文件的目录的内容。我不知道如何复制符号链接内容。伪代码如下所示:
for file in directory do
if is symlink
resolve symlink and copy its contents
else
copy the file / folder
Run Code Online (Sandbox Code Playgroud)
我的目录结构如下所示:
base/
dir1/
symlinkdir1*/ (--> ../somewhere/else/dirA)
/file1
/file2
symlinkdir2*/ (--> ../somewhere/else/dirB)
/file3
/file4
…
Run Code Online (Sandbox Code Playgroud)
在复制过程之后,我想要一个这样的目录结构:
base/
dir1/
symlinkdir1/ (no symlink, actual directory)
/file1
/file2
symlinkdir2/ (no symlink, actual directory)
/file3
/file4
…
Run Code Online (Sandbox Code Playgroud)
Dan*_*sta 23
cp -rL /source /destination
r = 递归 L = 跟随和扩展符号链接
归档时间: |
|
查看次数: |
8736 次 |
最近记录: |