Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hello guys !
we have load of metrics reports generated since 6 months , the thing is that the metrics contain .html and .png files in them.
now time has to come to sort out the metrics.
step -1 -- i want to now identify those old .html and .png by dates and sort them by dates and then keep them relevant date folders.
then after that
step-2 -- i want to put those relevant dated files according to date in a folder according to date and zip them every week and delete the unzipped ones.i am successful in step 2 , but i am getting up stuck at step 1 as i am not sure how to read read past dates of a file(.html and .png) using batch file programming , i am basically a sas programmer. i am struggling to get solution since 1 month , can any of you people please pull me out of this problem . your help is greatly appreciated.
thanks ,
sunny

If you have your metrics files in, let's say, c:\files and below that you have one folder for each month, cleverly named 01 ~ 12, try this:
===============================
@echo off & setLocal EnableDelayedExpansionpushd c:\files
for /f "tokens=* delims= " %%a in ('dir/b *.html *.png') do (
set datetime=%%~Ta
set MM=!datetime:~3,2!
echo move %%a !MM!
)
=================================
NOTES: You will need to tweak 'set MM' to your date layout.As written, it doesn't *DO* the MOVE; it just prevoews it.
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |