Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I copy all files that match a filter and the directory structure to UNC path will powershell:

For example with the filter as "*2011_01_02*.bak":

\arf.2011_01_02.bak
\foo\baz\arf.2011_01_02.bak

To \\192.168.1.1\meow\ with the result of:

\\192.168.1.1\meow\arf.2011_01_02.bak
\\192.168.1.1\meow\foo\baz\arf.2011_01_02.bak
share|improve this question
    
It sounds like it's raining cats and dogs over by you guys... –  Holocryptic May 20 '11 at 16:23

2 Answers 2

How about:

Copy-Item . -Destination "\\192.168.1.1\meow\" -Filter "*2011_01_02*.bak" -Recurse

(Based on some fiddling on a test box.)

share|improve this answer

Using robocopy, something like the following does the trick:

Robocopy.exe .\ \\192.168.1.1\meow *.ps1 /S

Not powershell, but seems to do the trick.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.