delete space from result name

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, xnview

Post Reply
bunak
Posts: 4
Joined: Sun Jun 02, 2013 10:53 am

delete space from result name

Post by bunak » Sun Jun 02, 2013 6:46 pm

Hi
I do batch convert images to png. But some source images have space in name (for example "1233 .bmp"). Is it possible delete/remove space from name when NConvert convert it (to "1233.bmp")?

Now my command look like this

Code: Select all

nconvert.exe -D -out png *.*
after finish converting i use cmd scripts for remove space from names.

Code: Select all

FOR /R d:\Project-Result\Img %%f IN (*) DO CALL:REN "%%f"
goto:eof

:: :REN    - subfunction
:: %~nxI   - expands %I to a file name and extension only

:REN
set "file=%~nx1"
ren %1 %file: =%
But, it is Better if space will remove when NConvert converting images.

User avatar
oops66
XnThusiast
Posts: 1999
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: delete space from result name

Post by oops66 » Sun Jun 02, 2013 7:53 pm

Hello,
FI: ... For me, it's better to replace spaces in filenames with underscores. (for readability)
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

cday
XnThusiast
Posts: 2195
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: delete space from result name

Post by cday » Tue Jun 04, 2013 10:20 am

bunak asked:

Is it possible to delete/remove space from name when NConvert convert it (to "1233.bmp")?
I don't think so.

But as NConvert can process a folder of images, maybe a batch file .bat that first calls NConvert then calls your cmd.exe script?

Note: No spaces in paths allowed if wildcards are used in file names.

Post Reply