Page 1 of 1

Reanming Files

Posted: Mon Mar 24, 2014 10:32 am
by juneb1022
I'm trying to find a doc or tutorial that explains how to rename files by adding a certain set word + the first 4 characters of that file.

E.G....

12341803.123 will be renamed Diners_1234_12341803.123

or

67891803.456 will be renamed Diners_6789_67891803.456

Any help is appreciated.

Re: Reanming Files

Posted: Mon Mar 24, 2014 10:51 am
by jvierra
This would be a good place to start: http://www.sapien.com/books/Windows-PowerShell-2

Re: Reanming Files

Posted: Tue Mar 25, 2014 2:16 pm
by juneb1022
Ok, I'm getting there.. :)


foreach ( $file in $files ) {
$str = Get-ChildItem "$Source\*.*" -Name
$str.Substring(0,4)
}

Re: Reanming Files

Posted: Tue Mar 25, 2014 2:51 pm
by jvierra
Try
Help rename-item -full