Computing.Net > Forums > Programming > batch file help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch file help

Reply to Message Icon

Name: sunny_22
Date: May 28, 2009 at 06:06:06 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 28, 2009 at 07:40:05 Pacific
Reply:

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 EnableDelayedExpansion

pushd 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


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch file help

batch file help www.computing.net/answers/programming/batch-file-help/13830.html

Batch File Help www.computing.net/answers/programming/batch-file-help-/11464.html

batch file help www.computing.net/answers/programming/batch-file-help/190.html