powershell - Copy directories when their name matches -Like txt files -
I am trying to copy a set of directories. I have text files that have the same name and I need to match those text files to directories, to determine which directory is copied.
This is what I did and I did not know how to fix it. I am going in circles around
$ destination = ".. \ .. \ $ args \ images \" $ Txtfiles = Get-ChildItem $ Destination -Include * .txt $ source = ".. \ .. \ .. \ Images \ "| ? {$ _. PSIsContainer} | Where-object {$ _. Name- "" $ $ txtfiles * "} | Copy-Item is an example of $ Destination
txt file: 1e03655b-0aac-48b2-82f3-75942084af7a.txt
folder:. name.1e03655b-0aac-48b2-82f3-75942084af7a
I folders that match txt files and txt file The folder needs to be copied to the directory
thanks
you want to expand basename attributes of text files
1e03655b-0aac-48b2-82f3-75942084af7a 1e03655b-0aac-48b2-82f3-75942084af7b 1e03655b-0aac-48b2-82f3-: .txt Hiss ) And as such is an array of strings 75942084af8g 1e03655b-0aac-48b2-82f3-75942084afba
Then your $ source =
line a directory and not just need to pull the string down the pipe line, and then I would suggest to match directory names with a regex match and I see whether it matches -in $ txtfiles
.
$ Destination = ".. .. .. $ $ ElGs \ Images \" $ txtfiles = Get-ChildItem $ Destination-Filter * .txt | Select -expaint property nonstop $ source = ".. \ .. \ .. \ images \" gci $ source-directory | ? {$ _. Name-matching "(\ w {8} - \ w {4} - \ w {4} - \ w {4} - \ w {12}) $"} | % {If it matches $ ([1] - $ in textile) {per-item $ _ absolute = destination}}
Comments
Post a Comment