i can't believe difficult i'm finding it.
i have folder on server share. folder has number of subfolder may, or may not, contain file want overwrite latest-version.
i've done many google search & figured command below me want:
get-childitem \\server1\websites\website\xml -name "description-15240.txt" -recurse | copy-item ".\description-15240.txt" -destination $_.fullname
...but doesn't.
so, break command down parts & find get-childitem returns file path root of -name parameter i.e.
1\infinite\description-15240.txt 68\infinite\description-15240.txt 79\infinite\description-15240.txt 80\infinite\description-15240.txt
rather \server1\websites\website\xml\1\infinite\description-15240.txt i'm after.
the problem: can't get-childitem return full path | { $_.fullname }
doesn't neither | { $_.parent }
can & possiblly tell me if copy-item
work well?
many thanks, n
name
parameter filter name of file, if want full path of file use include
parameter.
get-childitem \\server1\websites\website\xml -include "description-15240.txt" -recurse | % { copy-item ".\description-15240.txt" -destination $_.fullname }
Comments
Post a Comment