Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8579341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:35:30+00:00 2026-06-11T20:35:30+00:00

I have files with an ID , model , and date . the files

  • 0

I have files with an ID, model, and date. the files have a format similar to 10000_9999-99_10-01-2011.zip (where 10000 is the ID, 9999-99 is the model, and of course 10-01-2011 is the date).

I would like to modify the dates of these files, but maintain the interval between sessions with the same ID. For example, if 2 sessions had the dates 1/1/2011 and 2/1/2011, and I wanted to update the last session date to 8/1/2012, the first session would have the date 7/1/2012.

Currently my code looks like this:

@echo off
setlocal enabledelayedexpansion
del filedates.txt
FOR /F "tokens=1,2,3,4,5 delims=_" %%a in (filenames.txt) do @echo %%c >>filedates.txt
FOR /F "tokens=1,2,3 delims=-" %%a in (filedates.txt) do (
  echo %%a%%b
)

The output is similar to this (YearMonth):

201107
201109
201204
etc..

I was looking to read a line in filedates.txt, store this date as a variable, then read the next line, and store this as another variable. That way the two variables could be compared to see which is greater, and the process would continue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:35:32+00:00Added an answer on June 11, 2026 at 8:35 pm

    One straightforward way to do read two lines at a time is to process the lines in the input file one by one with a for /f loop, and “react” only on even numbered lines. Here’s a sample code:

    @echo off
    setlocal enabledelayedexpansion
    set evenflag=1
    for /f "tokens=*" %%x in (filedates.txt) do set x1=!x2! && set x2=%%x && (
    set /a evenflag^^=1 && if !evenflag!==1 (
        rem Do something with !x1! and !x2!
    ))
    

    Here the variable evenflag is a boolean flag that indicates whether the current line number is even (1 for even lines, 0 to odd lines). x1 and x2 hold the currently read pair of lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have DirectX .x files and I would like to display the model in
I have several existing XML schema files with a defined data model. I would
I have six source files and I would like to link them using the
I have a Python project with following directory structure: /(some files) /model/(python files) /tools/(more
I have a restfull webservice that requires loading trained model files and to create
I have the following Model and Controller files, and when i visit this url,
I have splitted two models in two files : website.py class WebSite(models.Model): ... maintenance_page
In my views i have the date in the following format s_date=20090106 and e_date=20100106
I am parsing text files looking for specific entries like so grep -e 'Model'
i have an entity-model file (edmx) file which contains few tables and few stored

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.