Solved rename all files in folder except todays created file

May 9, 2012 at 03:34:41
Specs: Windosxp
i m having folder called c:\data it contain many files having name like date eg.20120507.csv and i want to rename all files with adding a fixed code to every file except todays created file like 416_20120507.csv .

Help me and thanks in advance


See More: rename all files in folder except todays created file

Report •


#1
July 9, 2012 at 01:49:54
✔ Best Answer
Old thread but for the exercise:

@echo off
set y=%date:~-4%
set d=%date:~7,2%
set m=%date:~4,2%
set t=%y%%m%%d%
set p=416
for /f "tokens=*" %%i in (
'dir /a-d /b *.csv'
) do (
if not {%%~ni}=={%t%} (
move %%i %p%_%%i
))

Tony


Report •
Related Solutions


Ask Question