Rename files and move to a folder

Hello i’m trying for a while to rename pdf files that are like letters in the beginning and in the end date: example_if_name_04.09.2017.pdf. I want to rename all of them to date 04_09_2017.pdf or 04092017.pdf.

I did something like this:

$z = Get-ChildItem c:\fso -Filter *.pdf -Recurse | % { $_.FullName }
$files = $a -replace ‘[^0-9]’, ‘’

foreach($i in $files)
$d = $i+".pdf"
Rename-Item $z $i -WhatIf

# Replace dot with underscore and keep extension
Get-ChildItem C:\fso -Filter *.pdf | Rename-Item -NewName {
    ($_.BaseName -replace '\.','_') + $_.Extension}

Thanks, done it with this:

Get-ChildItem C:\fso -Filter *.pdf | Rename-Item -NewName {
    ($_.BaseName -replace '[^0-9]', '') + $_.Extension}

You can try the below command:


move file.ext \server\folder\newfile.ext

move /?

In PowerSHell:

Move-Item file.ext \server\folder\newfile.ext

Move-Item -?

In VBScript:

fso.MoveFile "file.ext:, “\server\folder\newfile.ext”

For more information, please checkout the below articles:

I use, Batch Rename Files Tool. You can easily found hier that allows you to quickly rename all the files in a specified directory.