Hi all,

I am having a play around with batch files but have hit a stumbling block.

The file returns the contents of an image folder and outputs the results in html format as such:

Thumbnail - Filename (usable link) - Creation Date - Modified Date

Please bear in mind that this is a work in progress and may look a little messy.

What I am stuck on is that the Creation Date variable contains the Creation Time which is also output in the result.
I have no need for the Creation Time of the file to be shown and would like this element to be removed from the resulting output.

Code Below:

@ECHO OFF &SETLOCAL
(FOR /f "delims=" %%a IN ('dir /b /a-d /s /n "C:\Documents and Settings\All Users\Documents\My Pictures\Pics & Vids"') DO (
    FOR /f "tokens=1-3*" %%x IN ('dir /a-d /tc "%%~a"^|findstr "^[0-9]"') DO (
        ECHO ^<img src="%%a" width="20px" border="2"^>^<a href="%%a"^>%%~nxa^</a^>,%%~ta,%%x ^</br^>
    )
))>DIR.html
TYPE DIR.html

Any help would be appreciated

Kind regards..,

What language are you using? That doesn't look like any shell script I've ever seen.

Looks sort of like Windows DOS shell code. Gah...

Hi,

yes, this is Windows DOS code. I could not see another forum index to place this in and I did look through and find other DOS batch code code questions in this section.

I have since resolved this to get my desired outcome:

@ECHO OFF &SETLOCAL
(FOR /f "delims=" %%a IN ('dir /b /a-d /s /n "C:\Documents and Settings\All Users\Documents\My Pictures\Pics & Vids\2002"') DO (
    FOR /f "tokens=1-3*" %%x IN ('dir /a-d /tc "%%~a"^|findstr "^[0-9]"') DO (
      for /f %%c in ("%%~ta") do (
         ECHO ^<img src="%%a" width="20px" border="2"^>^<a href="%%a"^>%%~nxa^</a^>,%%~c,%%x ^</br^>
      )
    )
))>DIR.html
TYPE DIR.html

Kind regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.