I still haven't gotten a good reply about this. Right now this is what I have:
== beging paste =:: if param passed - do current folder tree
:: else do \CSG_PICS in each Hard Drive....
::
if "%1" ne "" goto here1
for %drv in ( %_HDRIVES ) (
cdd "%drv%\CSG_PICS"
:here1
msgbox OK "FIXJPGS" "In %_CWD"
global /i /q gosub DoFldr
if "%1" ne "" goto here2
cdd -
)
Goto here2
:DoFldr
echo %_CWD
for %fn in (*MA[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9].jpg) ren "%fn" %@left[-15,%@name["%fn"]].jpg
for %fn in ("*%nbsp;*.jpg") ren "%fn" "%@replace[%nbsp;,_,%fn]"
for %fn in ("* *.jpg") ren "%fn" "%@replace[ ,_,%fn]"
for %fn in ("*ª*.jpg") ren "%fn" "%@replace[ª,_,%fn]"
for %fn in ("*'*.jpg") ren "%fn" "%@replace[',_,%fn]"
for %fn in ("*-*.jpg") ren "%fn" "%@replace[-,_,%fn]"
:: for %fn in ("*`*.jpg") ren "%fn" "%@replace[`,_,%fn]"
for %fn in ("*~*.jpg") ren "%fn" "%@replace[~,_,%fn]"
for %fn in ("*__*.jpg") ren "%fn" "%@replace[__,_,%fn]"
for %fn in ("* _*.jpg") ren "%fn" "%@replace[ _,_,%fn]"
for %fn in ("*_ *.jpg") ren "%fn" "%@replace[_ ,_,%fn]"
RETURN
:here2
:========================================================= end paste =
When I call with no param it says:
[D:\]c:\BATCH\FIXJPGS.BTM
[D:\CSG_PICS]
It should be saying
[D:\]c:\BATCH\FIXJPGS.BTM
C:\CSG_PICS
C:\CSG_PICS\Dir1
C:\CSG_PICS\Dir2
D:\CSG_PICS\
D:\CSG_PICS\Dir1
D:\CSG_PICS\Dir2
----- Original Message -----
From:
[email protected]
To:
[email protected]
Sent: Sunday, August 30, 2009 09:28 PM
Subject: RE: [Support-t-1351] Re: General questions
I sent the last reply too quickly - sorry....
===================I see
DO varname IN [range...] [/I:"text" /S[n] /A:[[-|+]rhsadecijopt] fileset
but wouldn't GLOBAL be easier as I have several
FOR %fn in (whatever) ren "%fn" "newname"
....
so wouldn't I have to use one one DO statement with each REN statement.
================================I have currently:
for %drv in ( %_HDRIVES ) (
cdd %drv\CSG_PICS
msgbox OK "FIXJPGS" "In %_CWD"
:here1
global /i gosub DoFldr
if "%1" ne "" goto :here2
cdd -
)
oFldr
for %fn in (*MA[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]_[0-9][0-9][0-9][0-9].jpg) ren "%fn" %@left[-15,%@name["%fn"]].jpg
for %fn in ("*%nbsp;*.jpg") ren "%fn" "%@replace[%nbsp;,_,%fn]"
for %fn in ("* *.jpg") ren "%fn" "%@replace[ ,_,%fn]"
for %fn in ("*ª*.jpg") ren "%fn" "%@replace[ª,_,%fn]"
for %fn in ("*'*.jpg") ren "%fn" "%@replace[',_,%fn]"
for %fn in ("*-*.jpg") ren "%fn" "%@replace[-,_,%fn]"
:: for %fn in ("*`*.jpg") ren "%fn" "%@replace[`,_,%fn]"
for %fn in ("*~*.jpg") ren "%fn" "%@replace[~,_,%fn]"
for %fn in ("*__*.jpg") ren "%fn" "%@replace[__,_,%fn]"
for %fn in ("* _*.jpg") ren "%fn" "%@replace[ _,_,%fn]"
for %fn in ("*_ *.jpg") ren "%fn" "%@replace[_ ,_,%fn]"
RETURN
================================ ----- Original Message -----
From: Steve Fábián
To:
[email protected]
Sent: Saturday, August 29, 2009 11:26 PM
Subject: RE: [Support-t-1351] Re: General questions
Charles S. Galloway:
| I have a series of statements to be run in a global routine.
| After adding a few more statements I now get an error so what is the
| best way to correct this?
Charles Dye:
| You're aware that DO supports /S now, right? In a batch file,
| DO /S is probably preferable to GLOBAL in most cases. I tend to think
| of GLOBAL as a hack for the benefit of not-very-smart externals, not
| as a feature to use regularly.
Charles S. Galloway:
| It needs to be backward compatible back to 8.02..... DO /S
| hasn't been available that far back...
DO /S is available in 4NT 8.02. The equivalent of the /N option of the
GLOBAL command (not used by the OP) became available in the DO
command only in V10, and /J not yet. The /H option can be emulated by
the /A: option.
--
HTH, Steve