Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Powershell Dateiname mit Änderungsdatum

$
0
0

Hallo,

ich habe ein Ordner mit ganz vielen .jpg Bilder.

Dies möchte ich alle aufeinmal mit einem PowerShell Skript umbenennen.

Als Dateiname soll das Änderungsdatum sein.

doch leider geht das nicht

hier mal men code

$Path = “C:\test\"
$Files = Get-ChildItem -Path $Path -Recurse -Include *.jpg

foreach ($File in $Files){
    $OldPath = $File.FullName
    $date = $Files.lastwritetime.ToString("d.M.yyyy HH.mm")
    $date

    $NewName = $Date + ($OldPath.Substring($OldPath.Length - 10, 10))
    Rename-Item -Path $OldPath -NewName "$NewName"
}


Viewing all articles
Browse latest Browse all 2314

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>