How to rename a filename to current date with batch

How to rename a filename to current date with batch

In windows environment, it is possible to rename files through command prompt. You need "ren" command to complete the operation.

ren old-file-name new-file-name

It is also possible to use command prompt commands from batch files.

To rename test.log to YYYYMMDD.log create a rename.bat file with content

ren "test.log" "%date:~10,4%%date:~7,2%%date:~4,2%.log"

Using this batch command, you can rename filenames to current date.


added 10 years 6 months ago

- Average Calculator
- Most frequently used Linux commands 5
- Most frequently used Linux commands 4
- Most frequently used Linux commands 3
- Most frequently used Linux commands 2
- Most frequently used Linux commands 1
- How to rename a filename to current date with batch
- How does a mutex work? What does a mutex cost?
- Locking : Mutex vs Spinlocks
- Description of Lock, Monitor, Mutex and Semaphore
- Difference between Mutex and Semaphore
- Difference between association, aggregation and composition
- Coordinating C/C++ ØMQ and .NET ØMQ
- Regular Expressions (Regex) Reference Sheet