【问题标题】:XCOPY files in batch to another folder but with structure of foldersXCOPY 文件批量复制到另一个文件夹,但具有文件夹结构
【发布时间】:2013-08-01 08:39:37
【问题描述】:

我正在努力完成以下工作。

假设我有一个这样的目录结构

C:\photos\all\abc\def\001.jpg
C:\photos\all\abc\def\002.jpg
C:\photos\all\abc\def\003.jpg
C:\photos\all\xyz\111.jpg
C:\photos\all\xyz\222.jpg
etc.

我想使用 XCOPY 将某些文件复制到另一个基本目录,但我想保留文件夹的结构。因此,例如我想将上面示例中的 3 个文件复制到另一个磁盘。

D:\newphotos\abc\def\001.jpg
D:\newphotos\abc\def\002.jpg
D:\newphotos\xyz\111.jpg

我怎样才能做到这一点?

我尝试了以下方法,但似乎都没有做我想做的事情(我从 C:\photos\all 运行了这些)

XCOPY "abc\def\001.jpg" "D:\newphotos\abc\def\001.jpg" (keeps asking if it is a file or folder)

XCOPY "abc\def\001.jpg" "D:\newphotos\" (doesn't create the target folder structure)

XCOPY /S "abc\def\001.jpg" "D:\newphotos\" (doesn't create the target folder structure)

【问题讨论】:

    标签: structure directory xcopy


    【解决方案1】:

    啊,终于找到了。在文件名后面加上星号 * 就可以了。所以,对于任何有同样问题的人:

    XCOPY "abc\def\001.jpg" "D:\newphotos\abc\def\001.jpg*"
    

    这就是诀窍。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-03
      • 2010-11-02
      • 2018-06-25
      • 2012-07-28
      • 2013-11-30
      • 1970-01-01
      • 2013-03-01
      相关资源
      最近更新 更多