Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I receive a lot of data files from my clients which are named in date time format. Example File Name: 20121029153045.txt, which means year 2012, month 10, day 29, hour 15, minutes 30 and seconds 45.

I need to quickly check the dates for which the files are missing or not received. For example, if I receive files for 3 months, starting from August, I need to check which are the missing files from August to October.

What is the quickest way to do this? I am using Windows XP SP 2, 32 bit

Thanks.

share|improve this question
    
is there any pattern in which they are created? Like are they produced every hour, every minute or so on? –  Journeyman Geek Oct 29 '12 at 13:27
    
Usually they are created every day, but I do not receive them every day. My clients mail me once in a week or arbitrarily. –  AllSolutions Oct 29 '12 at 13:29
    
ahh, so YYYYMMDD is significant here, and need to be in order? –  Journeyman Geek Oct 29 '12 at 13:30
    
yes .. These files are in csv format. Inside the file also, each record has date time, which is the 4th comma separated field. Each record has a serial no. which is always incrementing, even across files. This serial no. field is the 5th field. I also need to check for any gaps between the serial no. –  AllSolutions Oct 29 '12 at 13:35
    
this is a little tricky - I don't think i can solve it myself right now, but am trying to get more information in order to. I have some ideas but of course it needs some work –  Journeyman Geek Oct 29 '12 at 13:38
show 1 more comment

1 Answer

up vote 0 down vote accepted

Use a batch file like this:

@echo off
for %%m in (08 09 10) do (
    for /l %%d in (1,1,9)   do if not exist 2012%%m0%%d* echo "2012%%m0%%d missing"
    for /l %%d in (10,1,31) do if not exist 2012%%m%%d*  echo "2012%%m%%d missing"
)

(but ignore days like 31 September that don't exist :)

share|improve this answer
    
good one.. instead of hardcoding 08 09 10, can I make it start from the 1st date for which file is available and then check up to the last date for which file is available, to find any missing files in between? –  AllSolutions Oct 29 '12 at 14:39
1  
You wanted a quick check. How much programming are you willing to do? (And what if the first/last one is missing?) –  CL. Oct 29 '12 at 15:21
    
By first one and last one, I mean the earliest / latest file available in the folder. By quick, I meant I am willing to do some setup work one time, if the solution can be run quickly and reliably in future. –  AllSolutions Oct 29 '12 at 15:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.