Page 1 of 1

Batch file: Del all "@2x" images.

Posted: 2015-08-06T11:43:41-07:00
by MomentumHunt91
This was my first thread:
viewtopic.php?t=28135
HDtoSD all:
Everything works perfect there. Much thanks again for this!


Now i want to got for the other side.

SDtoHD all:

-------------------------------------------------------------------------------
mkdir HDtemp
copy *.png HDtemp
del HDtemp/*.png
mogrify -verbose -format png -resize 200%% HDtemp/*.png
pushd HDtemp

set ext_list=(jpg png gif)
for %%X in %ext_list% do ( [First Trouble: It deletes all files. -> It should just delete the "@2x" elements (example@2x.png -I don´t know how-)
del /Q /S *.%%X
)

setlocal enableDelayedExpansion
for %%a in (*.png) do (
set "filename=%%~nxa"
set "purged_filename=!filename:@2x=!" [Second Troube: It calls "exmaple@2x.png to example.png it should make the ""contrary"".]
ren %%~nxa !purged_filename!
)

endlocal
-------------------------------------------------------------------------------

I know that i will lose some pixels but that doesn´t matter:p

If u don´t know what i actually mean go to the first thread (on the top).
The best way if u just can give me the right "codes" for these 4lines. Would be awesome ty.

For the full exmaple the CONTRARY of that:
http://img5.fotos-hochladen.net/uploads ... rljyvi.png

Much thanks!
MomentumHunt91

Re: Batch file: Del all "@2x" images.

Posted: 2015-08-06T12:02:01-07:00
by snibgo
This is a scripting question, with no relevance to ImageMagick.

I suppose ...

Code: Select all

del /Q /S *.%%X
... should be ...

Code: Select all

del /Q /S *@2x*.%%X
I don't understand your second problem. Do you want:

Code: Select all

set "purged_filename=%%~na@2x%%~xa"
I suggest you read about scripting, in your own language.

Re: Batch file: Del all "@2x" images.

Posted: 2015-08-06T12:31:43-07:00
by MomentumHunt91
snibgo wrote:This is a scripting question, with no relevance to ImageMagick.

I suppose ...

Code: Select all

del /Q /S *.%%X
... should be ...

Code: Select all

del /Q /S *@2x*.%%X
I don't understand your second problem. Do you want:

Code: Select all

set "purged_filename=%%~na@2x%%~xa"
I suggest you read about scripting, in your own language.
You undetstood it completely right everything works perfect now!
And sorry for the wrong "page use" i did my first thread here to because i need ImageMagick for the mogrify.
And my native language is german so it´s actually not that easy for me.

JUST SO MUCH THANKS TO YOU. You helped me a lot on thread 1 too!

Much thanks
MomentumHunt91

Re: Batch file: Del all "@2x" images.

Posted: 2015-08-06T12:34:05-07:00
by MomentumHunt91
#CLOSED