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.
Reanming Files
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Reanming Files
This would be a good place to start: http://www.sapien.com/books/Windows-PowerShell-2
Re: Reanming Files
Ok, I'm getting there..
foreach ( $file in $files ) {
$str = Get-ChildItem "$Source\*.*" -Name
$str.Substring(0,4)
}
foreach ( $file in $files ) {
$str = Get-ChildItem "$Source\*.*" -Name
$str.Substring(0,4)
}