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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

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

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

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

Post 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
Last edited by MomentumHunt91 on 2015-08-06T12:50:15-07:00, edited 3 times in total.
MomentumHunt91
Posts: 26
Joined: 2015-08-03T14:15:55-07:00
Authentication code: 1151

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

Post by MomentumHunt91 »

#CLOSED
Post Reply