Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

anytojpg,btm

Take Command 8.02.106 Windows XP [Version 5.1.2600]
Take Command Build 106 Windows XP Build 2600 Service Pack 3
Registered to Charles S. Galloway - 5 System License

I had two questions about the BTM below. One is there any way to make it
simplier or quicker? And thne I am getting:

TCMD: (Sys) C:\BATCH\anytojpg.btm [59] The system cannot find the file
specified. ""
TCMD: (Sys) C:\BATCH\anytojpg.btm [59] The filename, directory name, or
volume label syntax is incorrect. "C:\ALLFLDRS\_001\
i think it's because I have some off named files .... so it's the SETDOS /X
value? the filenames that have chars other than A-Z and 0-9 are:

(1)Untitled01
(2)Untitled01
(3)Untitled01
)
-)
00e701c6b6ba$c597ccb0$4101a8c0@DESKTOP
00e901c6b6ba$c597ccb0$4101a8c0@DESKTOP
00eb01c6b6ba$c597ccb0$4101a8c0@DESKTOP
4&w=192&r=2008-05-05T202413Z_01_N05401629_RTRUKOP_0_PICTURE0
=COLUMNISTS0106&ArtNo=604060328&Ref=AR&Profile=1061&MaxW=315
=iso-8859-9BQef9ayBH9mt5Hr8IEFya2FwbGFuLmpwZw===iso-8859-9BQf5rW79IFP2eWxlLm1wMw===iso-8859-9BREQVU0gR9xO3C56aXA==iso-8859-9BRWRhIE1ldGluINZ6GxrCBEbB1bSBHG78bS0ubXAz=iso-8859-9BTUVUUk8gLSBTT04gR91E3d7dTS5tcDM==iso-8859-9Ba2FyXP9ay56aXA==iso-8859-9Bc2FyXP9bi56aXA=AlyssaSutherland-Black+White-04
AlyssaSutherland-Black+White-11
BARTH'S
FWFwdHolidayFunniesThatareJustOfftheBeatenPath!]
I'SYPORN
Sean_Grey's
TOO)
Y'SY'TO
Y(NOYS~1
YBRITN~1
YBRITN~2
YBRITN~3
Y_BRIT~1
[[BRITNE
untitled-[2]
{2A5A8284-8B23-4
·_·~1

================================================setlocal
unalias *
goto start
TEXT
Goes thru globaly (in a user specifed home folder or the CWD
and for each .JPG or .JPEG file reads the first 2 characters
of each and if is "JG" then renames to a .ART extension and
only output is the RENaming of the file or an app. error
message if a .ART file already exists.
ENDTEXT
::
:: next 2 lines handles drive/folder change with %1
:: calling syntax: AnyToJpg.btm C:\DOWN\Temp
::
:start
CLS
set fn=start

setdos /x-4

set cOutfile=D:\AnyToJpg.btm
if exist %cOutfile del /q /w %cOutfile

>%cOutfile
iff %# eq 0 then
set sFold=%_CWD
else
set sFold=%1
endiff
pushd %@instr[0,2,%@full[%sFold]]
pushd %sFold
set nART=0
set nBMP=0
set nGIF=0
set nJPG=0
global /I gosub F_RENAME
echo %nART ART Files
echo %nBMP BMP Files
echo %nGIF GIF Files
echo %nJPG JPG Files
unset /q uNum
popd
popd
SETDOS /X+4
quit

:F_RENAME
do cname IN ( * )
set jp=%@fileopen["%cname",read,b]
iff %jp == -1 then
echoerr *** (%fn) is before errored File.
echo *** (%fn) is before errored File. >> %cOutfile
echo *** error opening (%_cwds%%cname) >> %cOutfile
iterate
endiff
set fn=%_cwds%%cname
set tst=%@fileread[%jp,16]
set dummy=%@fileclose[%jp]
set nm=%@full[%jp]
iff "%@instr[6,4,%tst]" == "JFIF" then
iff %@ext["%_cwds%%cname"] == "JPG" then
echo ""%_cwds%%cname" >> %cOutfile
else
:JPEG
echo ren "%cname" "%@name[%cname].JPG" >> %cOutfile
endiff
elseiff "%@left[2,%tst]" == "JG" then
:ART
echo ren "%cname" "%@name[%cname].art" >> %cOutfile
set nART=%@inc[%nART]
elseiff "%@left[3,%tst]" == "GIF" then
:GIF
echo ren "%cname" "%@name[%cname].GIF" >> %cOutfile
set nGIF=%@inc[%nGIF]
elseiff "%@left[2,%tst]" == "BM" then
:BMP
echo ren "%cname" "%@name[%cname].BMP" >> %cOutfile
set nBMP=%@inc[%nBMP]
else
rem echo *** unknown (%@instr[7,4,%tst]) (%_cwds%%cname)
endiff
unset /q fn, txt, dummy, nm
enddo
return
================================================
 
Its hard to read .. besides that I dont' see any fileclose functions
Not having them would cause errors you described
 

Similar threads

Back
Top