【发布时间】: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)
【问题讨论】: