Issue
Code backup
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
$Logfile = "F:\Code\VSC\PowerShell\Script\005 - Rename File by csv\logs.txt"
|
||||
|
||||
$Elements = Import-Csv -Path "C:\Users\cbo\Desktop\FZ Task\username2.csv"
|
||||
$i = 1
|
||||
|
||||
|
||||
foreach ($Element in $Elements) {
|
||||
|
||||
$FilePath = "C:\Users\cbo\Desktop\FZ Task\Voutcher to send\"
|
||||
$OldfileName = $i.ToString("000") + ".pdf"
|
||||
|
||||
$Target =$FilePath + $OldfileName
|
||||
$FileName = $Element.Surname + " " + $Element.Name + ".pdf"
|
||||
|
||||
Rename-Item -Path $Target -NewName $FileName
|
||||
|
||||
LogWrite($FilePath+$FileName)
|
||||
|
||||
$i++
|
||||
}
|
||||
|
||||
Function LogWrite
|
||||
{
|
||||
Param ([string]$logstring)
|
||||
|
||||
Add-content $Logfile -value $logstring
|
||||
}
|
||||
Reference in New Issue
Block a user