(view source code of simplesitemap.bat as plain text)
@ECHO OFF
:: Check Windows version and command line arguments
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
IF NOT "%~2"=="" GOTO Syntax
IF "%~1"=="" GOTO Syntax
SETLOCAL
PUSHD "%~dp0"
SET WebSite=%~1
SET XML="%~dpn0.xml"
TITLE Creating %~n0.xml
> %XML% ECHO ^<?xml version="1.0" encoding="utf-8"?^>
>> %XML% ECHO ^<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"^>
DATE /T | FIND "/" >NUL
IF ERRORLEVEL 1 (
FOR /F "skip=1 tokens=1-5* delims=- " %%A IN ('DIR *.php *.htm? ^| FIND "-"') DO (
TITLE %%F
>> %XML% ECHO ^<url^>
>> %XML% ECHO ^<loc^>%WebSite%/%%F^</loc^>
>> %XML% ECHO ^<lastmod^>%%C-%%B-%%A^</lastmod^>
>> %XML% ECHO ^</url^>
)
) ELSE (
FOR /F "tokens=1-5* delims=/ " %%A IN ('DIR *.php *.htm? ^| FIND "/"') DO (
TITLE %%F
>> %XML% ECHO ^<url^>
>> %XML% ECHO ^<loc^>%WebSite%/%%F^</loc^>
>> %XML% ECHO ^<lastmod^>%%C-%%A-%%B^</lastmod^>
>> %XML% ECHO ^</url^>
)
)
>> %XML% ECHO ^</urlset^>
ENDLOCAL
POPD
GOTO:EOF
:Syntax
ECHO SimpleSitemap.bat, Version 1.10 for Windows 2000 and later
ECHO Create a basic sitemap.org compliant XML sitemap
ECHO.
ECHO Usage: SIMPLESITEMAP http://www.website.org
ECHO.
ECHO Where: http://www.website.org should be replaced by your own website's URL
ECHO including protocol (e.g. http://) but without trailing backslash
ECHO.
ECHO Notes: Script must be located in the directory with the files to be indexed.
ECHO Output XML file will also be placed in the same directory.
ECHO File names must NOT contain "special" (high ASCII/Unicode) characters!
ECHO Script is hardcoded for PHP and HTM(L) files; modify if necessary.
ECHO Script assumes either MM/DD/YYYY or DD-MM-YYYY date format.
ECHO If you need to exclude files, use my Sitemap.bat instead.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
page last modified: 2024-04-16; loaded in 0.0101 seconds