开发者

powershell copy creates extra empty folders

开发者 https://www.devze.com 2023-03-16 15:59 出处:网络
i\'m using this simple command to copy over some files and folders that get dropped into a temp folder.

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百科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


I'm not actually sure why that folder is being created, but I think you want to call copy without the *:

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

This will recursively copy update_temp to target.

What you're doing is copying everything under update_temp to target. That's subtely different and while I can't quite puzzle out why you end up with first_folder\first_folder, I am certain that isn't what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号