Answer the question
In order to leave comments, you need to log in
How to find and rename a file?
Probably the simplest problem, with the simplest solution, but this is my first time dealing with CMD/BAT.
There is a Conditional folder C: \ TEMP, in which files periodically appear (once a month, excel files are uploaded using a bat script). They all appear with the same names, but with random numbers. For example:
"pattern_52773625_1.xls",
next. month is the same pattern, but with different numbers.
--
"shablon_62483624_1.xls",
same as pattern.
--
"reports_71439264_1.xls",
same as with pattern.
--
Task: Rename pattern_52773625_1 to "pattern 02-10-2021.xls" (02-10-2021 - The date at the time the script was executed. Other files are renamed in the same way.
Answer the question
In order to leave comments, you need to log in
Why don't you want to write something similar on ps for example?
Get-ChildItem -Path $env:C:\TEMP\ -Filter "*.xls*" -Recurse | Where-Object {$_.LastWriteTime -ge $date} | Foreach {"$($_.BaseName) $(get-date -f yyyy-MM-dd)$($_.extension)"}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question