Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Variable in the file’s name filter.

$
0
0

Hello!

I am new to PowerShell scripting your help will be really appreciated!

The following works for me by running it as .ps1 script:

$source=”C:\Backup\Full\”
Get-ChildItem $source -Recurse -filter “aaa_bbb_client_FULL.txt”

The following does not work for me by running it as .ps1 script:

$client=”sclient”
$source=”C:\Backup\Full\”
Get-ChildItem $source -Recurse -filter “aaa_bbb_” + $client + “_FULL.txt”

error I am getting:
Get-ChildItem : A positional parameter cannot be found that accepts argument ‘+
‘.

Please help me to understand what I am missing.

Regards


Viewing all articles
Browse latest Browse all 13067

Trending Articles