DebbieCoates_IPL
Programmer
Hi, would appreciate any help
I am trying to write my first PowerShell script. I am copying files from one directory to another, between 2 times.
so far I have this
$StartDate = (Get-Date).Addminutes(-10)
$EndDate = Get-Date
$StrSource ="H:\SOURCE"
$StrTarget= "H:\TARGET"
Get-ChildItem $StrSource | Where-Object {($_.LastWriteTime.Date -ge $StartDate.Date) -and ($_.LastWriteTime.Date -le $EndDate.Date)} | Copy-Item -Destination $StrTarget
which copies all file from the source directory to the target directory, that are using the specified time period, however, I want to filter the file names so it looks for all xlsx files that begin with "Report_5", i.e. filename Report_BtestOne.xlsx , Report_BtestTwo.xlsx would both transfer, but Report_Cxxx.xlsx wouldn't, nor would Report_D.txt
Again, thank you for any help you can give me
I am trying to write my first PowerShell script. I am copying files from one directory to another, between 2 times.
so far I have this
$StartDate = (Get-Date).Addminutes(-10)
$EndDate = Get-Date
$StrSource ="H:\SOURCE"
$StrTarget= "H:\TARGET"
Get-ChildItem $StrSource | Where-Object {($_.LastWriteTime.Date -ge $StartDate.Date) -and ($_.LastWriteTime.Date -le $EndDate.Date)} | Copy-Item -Destination $StrTarget
which copies all file from the source directory to the target directory, that are using the specified time period, however, I want to filter the file names so it looks for all xlsx files that begin with "Report_5", i.e. filename Report_BtestOne.xlsx , Report_BtestTwo.xlsx would both transfer, but Report_Cxxx.xlsx wouldn't, nor would Report_D.txt
Again, thank you for any help you can give me