![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | copy-item down through folders It seems simple: I just want the equivalent of xcopy /S which copies a full directory tree. copy-item source target -recursive does not give the desired results if a subfolder to be copied already exists in the target tree. In that case, copy-item does not proceed to examine the members of the folder, to copy them. I want the target to be refreshed from the source. How to? THanks, Leo |
My System Specs![]() |
| | #2 (permalink) |
| | Re: copy-item down through folders That is a bug in Copy-Item. Maybe the function in this post helps: http://groups.google.com/group/micro...A16EB51@xxxxxx -- Kiron |
My System Specs![]() |
| | #3 (permalink) |
| | Re: copy-item down through folders Leo Tohill wrote: Quote: > It seems simple: I just want the equivalent of > xcopy /S > which copies a full directory tree. > > copy-item source target -recursive > does not give the desired results if a subfolder to be copied already exists > in the target tree. In that case, copy-item does not proceed to examine the > members of the folder, to copy them. > I want the target to be refreshed from the source. > How to? > THanks, > Leo > > http://www.bsonposh.com/modules/wordpress/?p=38 It might provide what you want. -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #4 (permalink) |
| | Re: copy-item down through folders Kiron, your solution doesn't address the existence of folders at any depth in the target, does it? "Kiron" wrote: Quote: > That is a bug in Copy-Item. Maybe the function in this post helps: > > http://groups.google.com/group/micro...rshell/msg/332 > 7f2d1544e7fb6?as_umsgid=6CAEDDC7-0F1A-4B21-8FB0-E6102A16EB51@xxxxxx > > -- > Kiron > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: copy-item down through folders The function will _copy_ every folder and file of a source folder to a target folder. If the target folder has more folders than the source - at any depth - nothing happens to them, i.e., they'll remain. The function does not synchronize the source and target, just copies everything from the source to the target maintaining the source's structure. -- Kiron |
My System Specs![]() |
| | #6 (permalink) |
| | Re: copy-item down through folders The function will overwrite any existing folder/file - Hidden, ReadOnly - in the target without prompting. The function is equivalent to cmd /c xcopy /e cmd /c xcopy /? . . . /S Copies directories and subdirectories except empty ones. /E Copies directories and subdirectories, including empty ones. . . . -- Kiron |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Copy-Item : Container cannot be copied onto existing leaf item. | PowerShell | |||
| Can the copy-item cmdlet be used to copy public folders to C: ? | PowerShell | |||
| copy-item changing files attributes on network copy failures | PowerShell | |||
| Getting Copy-Item to display messages (like the old COPY command in CMD.EXE) ?? | PowerShell | |||
| Copy-Item or Copy-ItemProperty and Remote Registry. | PowerShell | |||