What does the double asterisks 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)

Leave a Comment