Emo
2009-09-10 15:20:21 UTC
I hope this is simple :)
I'm looking to rename a file in C:\folder\dailybackup.bak to C:\folder
\MMddyy-hhmm.bak
I just need to do it for one file. The original filename with always
be "dailybackup.bak"
I understand how to use get-date and how to format it as in:
$datetime = get-date -f MMddyy-hhmmtt (using tt for am or pm)
And I understand how to do a simple file rename using ren. In rename,
it asks for the path and then NewName...but I can't figure out how to
get the info from $datetime into the filename.
so...how can I rename the file using the info from $datetime?
I'm pretty new to powershell so any help is greatly appreciated :)
I'm looking to rename a file in C:\folder\dailybackup.bak to C:\folder
\MMddyy-hhmm.bak
I just need to do it for one file. The original filename with always
be "dailybackup.bak"
I understand how to use get-date and how to format it as in:
$datetime = get-date -f MMddyy-hhmmtt (using tt for am or pm)
And I understand how to do a simple file rename using ren. In rename,
it asks for the path and then NewName...but I can't figure out how to
get the info from $datetime into the filename.
so...how can I rename the file using the info from $datetime?
I'm pretty new to powershell so any help is greatly appreciated :)