1

i'm using this simple command to copy over some files and folders that get dropped into a temp folder.

copy c:\update_temp\* c:\target\ -recurse -force

say update_temp has following structure

c:\update_temp\first_file.txt

c:\update_temp\first_folder\anotherfile.txt

when i run the command, here is what i end up with

c:\target\first_file.txt

c:\target\first_folder\anotherfile.txt

**c:\target\first_folder\first_folder**

not sure why that last entry is happening, so now i end up with a ton of unnecessary folders.

I'm running powershell v1

Any ideas? Thanks

4

1 回答 1

2

我实际上不确定为什么要创建该文件夹,但我认为您想在没有 * 的情况下调用复制:

copy c:\update_temp\ c:\target\ -recurse -force

这将递归地将 update_temp 复制到目标。

您正在做的是将 update_temp 下的所有内容复制到目标。这是微妙的不同,虽然我不能完全理解为什么你最终会得到 first_folder\first_folder,但我确信这不是你想要的。

于 2011-07-01T19:35:56.147 回答