Batch Help With Indexing jpg's within a folde

Microsoft Windows 7 ultimate 32-bit
August 11, 2010 at 22:17:20
Specs: Windows 7
what's wrong with this code

@echo off
title Picture Indexer
color 02
mode con: cols=50 Lines=10

if exist gallery.xml (del gallery.xml)

Set /a z = 1
echo ^<tiltviewergallery^> >> gallery.xml
echo 	^<photos^> >> gallery.xml

for /F "usebackq delims==" %%i IN (`dir /B /S *.jpg`) DO (
cls
	echo ^<photo imageurl="%%i"^> >> gallery.xml
	echo ^<title^>Image %z% ^</title^> >> gallery.xml
	echo ^</photo^> >>gallery.xml
	echo. >> gallery.xml
	Set /a z = %z% + 1
)

echo 	^</photos^> >>gallery.xml
echo ^</tiltviewergallery^> >>gallery.xml


The problems i have is it is placing the full directory in the %%i variable instead of just the file name and extension and the variable z inside the loop isn't incrementing.

Any help would be appreciated
Many Thanks crackruckles


See More: Batch Help With Indexing jpgs within a folde

Report •

#1
August 12, 2010 at 05:21:19
The problems i have is it is placing the full directory in the %%i variable instead of just the file name and extension
%%~NXi

and the variable z inside the loop isn't incrementing.
Use SETLOCAL ENABLEDELAYEDEXPANSION


Report •
Related Solutions


Ask Question