简体   繁体   English

将一个文件列表中的文件列表复制到另一个文件夹

[英]Copy a list of files in one file list to another folder

Below is the content of a file list.txt 以下是文件list.txt的内容

Source/GEPON/DOCSIS/C3160/2.2.0/src/com/xxx/ems/Log_en_US.xml
Source/GEPON/DOCSIS/C3160/2.2.0/src/com/xxx/ems/Log_zh_CN.xml

Source is under folder A; 源位于文件夹A下; Now I want to copy these two files into another folder B;meanwhile keeping the parent folder substructure. 现在,我想将这两个文件复制到另一个文件夹B;同时保留父文件夹的子结构。 I used xargs -a list.txt cp -t B ; 我用xargs -a list.txt cp -t B ; got the two files under one folder B without their parent folders. 将两个文件放在一个文件夹B下,但没有其父文件夹。 What do I need to do? 我需要做什么?

您希望将--parents选项设置为cp但这需要您在目录之间移动。

cd A; xargs -a ../list.txt cp --parents -t ../B

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM