Powershell .NET Create an Array of files from Remote Dir

Advertisement

jesc516
Joined:
Posts:
5

Powershell .NET Create an Array of files from Remote Dir

how would i go about creating an array of files from the remote directory once i am logged in?

this is what i want to do, but on the remote side.

$YYMD = ((Get-Date).AddDays(-1).ToString("yyyyMMdd"))

$arr = Get-ChildItem | Where-Object { ($_.name -match "ASSIGNMENTS_" + $YYMD + "*") -or ($_.name -match "PAYMENTS_" + $YYMD + "*") }

foreach ($a in $arr)
{
    ### Download files
}

the asterisk is there because that part of file name is a time stamp. the time is random.

would this be the most efficient method or is there a better alternative?

any help is greatly appreciated..

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Powershell .NET Create an Array of files from Remote Dir

The param keyword allows overriding the variable value on command-line. Refer to PowerShell manuals.

Reply with quote

Advertisement

You can post new topics in this forum