Moving a partial file to another folder RRS feed

  • Question

  • Hello,

    I am fairly new to powershell I am having trouble getting a file who's last few numbers in the file name change every month I was wondering if there was a way or command to find part of the file name exp c\windows\1251-01 

    Basically just have it find the 1251 part of the file 

    Thursday, March 7, 2019 1:19 PM

All replies

  • Get-ChildItem -Path C:\Folder | Where-Object {$_.Name -match '1251'}

    Thursday, March 7, 2019 1:31 PM
  • Using the -Filter parameter is faster than piping the list of all the files in a directory through a "Where" cmdlet.

    Get-ChildItem c:\windows -Filter 1251*
    Or just use a plain old wildcard!
    Get-ChildItem c:\windows\1251* 

    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    Thursday, March 7, 2019 4:04 PM
  •  Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,


    Just do it.

    Monday, March 11, 2019 5:58 AM