I often see PowerShell commands that use paths that use a double asterisks:
Copy-Item c:\source\** d:\target
The example may be wrong, as I don't understand POSH that well yet. But I do see examples using the **
in paths. What does it mean?
Actually, I believe the above answer is wrong.
Assume we have the following directory structure:
dbl_wc (top level)
--one_level_in
--aa.txt
--one_level_in1
--bb.txt
--deeper_dir
--abc.txt
Copy-Item .\dbl_wc\**\*.txt copy_target -Force
Will only look for *.txt in any directory under .\dbl_wc. And it won't look in sub-directories (so for example .\dbl_wc\one_level_in1\deeper_dir). So it will get both aa.txt and bb.txt, but not abc.txt. It would also not get any .txt file directly under dbl_wc
Essentially, the ** stands for a directory-wildcard, but not recursive.
EDIT: just tested it with *, and it does the same thing (so Copy-Item .\dbl_wc\*\*.txt copy_target -Force
does the exact same thing as above)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With