Mee8080 wrote:but i want date and time modified in format yyyymmddhhmmss. how
Did you look at my answer
Have you tried the JREPL.BAT solution
Do you understand why 11:00:00 PM must be named 230000 instead of 110000
If you are uncomfortable with JREPL, then the following pure batch script will work with any local date/time format, as long as the current directory path and file names do not contain a comma.
This again expects the prefix as the first and only argument. It will show the commands that would be used to rename all files in the current directory where the base name (excluding extension) does not contain a dot, and the extension consists only of digits.
Code: Select all
@echo off
setlocal disableDelayedExpansion
for /f delims^=^ eol^= %%F in (
'dir /b /a-d ^| findstr "^[^.][^.]*\.[0-9][0-9]*$"'
) do (
for /f "skip=1 delims=." %%A in (
'wmic datafile where name^="%__cd__:\=\\%%%F" get lastModified'
) do for /f %%B in ("%%A") do ECHO ren "%%F" "%~1%%B.%%~nF"
)
Once you verify it is producing the correct commands, simply remove the ECHO and re-run to actually rename the files.
Dave Benham