batch to retrieve files within folders based on time interval taken from folder name -


I'm new to batch scripting. I am working on the following,

There are many folders in my name

02_25-06_00
02_25-06_10
02_25-06_20
02_25- 06_30
02_25-06_40
02_25-06_50
02_25-07_00

Where is 2 months, 25 is date, 06 hours and 00 minutes

In each of these files, there are two folders named A and B. Each of these folders has 5 text files.

I need a batch script which displays the input and all text files in the form of 06: 00 to 06:20 in each of two sub folders, as follows < P> 02_25-06_00-A1.txt
02_25-06_00-A2.txt
02_25-06_00-a 3.txt
02_25-06_00-A. 4.txt
02_25-06_00-A5 .txt
02_25-06_00-B1txt
02_25-06_00-B 2.txt
02_25-06_00-B 3.txt
02_25-06_00-B 4.txt
02_25 -06_00-B 5.txt
02_25-06_10-A1.txt
02_25-06_10-A2.txt
02_25-06_10-A 3.txt
02_25-06_10-A 4.txt < Br> 02_25-06_10-A5.txt
02_25-06_10-B1.txt
02_25-06_10-B2.txt
02_25-06_10-B 03.txt
02_25-06_10-B4. Txt
02_25-06_10-B5.txt

Please Batch This Help me in the script ...

Here is the batch file for creating test case folders and files: <% p>

  @echo off %% (1 2 3 4 5) In %% B (AB) for %% c (02_25-06_00 02_25-06_10 02_25-06_20 02_25-06_30 02_25-06_40 02_25-06_50 02_25-07_00) Do md %% c \ %% b 2 & gt; ; Null & amp; Type nul & gt; %% c \ %% b \ %% a.txt   

Edit - to optimize new folder naming (as stated in the comments) Include code changes for changes

    • Folder A = 9k (<%> c changes in file set)

    • Folder B = C2 (<%> C changes in file set)

    • Named folder = hh-mm_hh-mm ( remains without any change

       for  / f "Tokens = 1-2 delims = _" %% a in ('dir / b / on / ad'% somewhere% '') (if "%% b" geq "% start :: = -%" For "%% b" leq "% end :: = -%" (%% c ("% anywhere \"% \ %% a _ %% b \ 9k \ *. * "%% somewhere% \ %% _ %% b \ c2 \ *. *") (For / f "tokens = *" %% d ("%% ~ dpc.") (Echo) (%% - %% - %% ~ nxd %% ~ nxc)))    

  • Comments

    Popular posts from this blog

    c - Mpirun hangs when mpi send and recieve is put in a loop -

    python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

    java - Unable to get JDBC connection in Spring application to MySQL -