folder name with spaces

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

Moderators: XnTriq, helmut, xnview

unquestioned2
Posts: 20
Joined: Mon Apr 30, 2012 10:32 pm

folder name with spaces

Post by unquestioned2 »

How do I open files which are located in a folder with spaces in the folder name like
C:\This Is Just A Folder Name\

nconvert commands -D C:\This Is Just A Folder Name\*.tiff doesn't work.
nconvert commands -D "C:\This Is Just A Folder Name\"*.tiff doesn't work either.

I use a batch file for this.
Or is there a special way for typing the spaces in the batch file?
User avatar
XnTriq
Moderator & Librarian
Posts: 6354
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: folder name with spaces

Post by XnTriq »

Entering dir /x at the command prompt should give you the 8.3 short filename notation.
unquestioned2
Posts: 20
Joined: Mon Apr 30, 2012 10:32 pm

Re: folder name with spaces

Post by unquestioned2 »

That with dir /x worked. Thanks!
(That with the help-programs goes in a direction I'm not interested in.)

as an example:

instead of
-D C:\PICTURES\portable stuff\%image folder%\nightly\-77577-\

I now use
-D C:\PICTURES\PORTAB~1\%%IMAGE~2\nightly\-77577-\*.*

and that works.


But I'm still wondering why I have to use the second %.

It's like
-out jpeg -o C:\PICTURES\developed\%%.jpg

which also didn't work (properly) without the second %.

(At least I missed the point there this behaviour is documented.)
User avatar
XnTriq
Moderator & Librarian
Posts: 6354
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: folder name with spaces

Post by XnTriq »

unquestioned2 wrote:nconvert commands -D "C:\This Is Just A Folder Name\"*.tiff doesn't work either.
Please try the following syntax:
  • nconvert commands -D "C:\This Is Just A Folder Name\*.tiff"
unquestioned2 wrote:But I'm still wondering why I have to use the second %.

It's like
-out jpeg -o C:\PICTURES\developed\%%.jpg

which also didn't work (properly) without the second %.

(At least I missed the point there this behaviour is documented.)
8<------------------------------------------------------------>8

Related topics for future reference:
xnview ([url=http://newsgroup.xnview.com/viewtopic.php?t=44&p=182#p182]nconvert syntax: .ico to .bmp?[/url]) wrote:
Guidance wrote:BTW, does nconvert support quotes if the path contains spaces?
Yes, use " ("my folder"
xnview ([url=http://newsgroup.xnview.com/viewtopic.php?t=15383&p=63475#p63475]Batch-convert single tiffs to multipage tiffs...[/url]) wrote:
firestar77 wrote:Do you have tried
for /D %i in (*) do nconvert -multi -out tiff -o %i.tif %i\*.tif
And yes, if filename or folder have a space, there is a problem
Andys ([url=http://newsgroup.xnview.com/viewtopic.php?t=5196&p=62814#p62814]Conversion with subfolders[/url]) wrote:For me, previous sample didn't work when there were spaces in dir names.
Here's an update -

@for /R /D %%a in (*) do nconvert.exe <your_options_here> %%~sa\*.*

~s is a documented 'for' feature, it converts to short path
unquestioned2
Posts: 20
Joined: Mon Apr 30, 2012 10:32 pm

Re: folder name with spaces

Post by unquestioned2 »

XnTriq wrote: Please try the following syntax:
  • nconvert commands -D "C:\This Is Just A Folder Name\*.tiff"
I didn't mention it, but I'd tried that already and it didn't work - if I remember me correctly.
XnTriq wrote: Related topics for future reference:
...
The additional links seem... are... I don't know. Similar or related to the topic. Nothing more, nothing less.

After all I hoped for another solution. For example in HTML there is difference between ENTER and
SHIFT + ENTER. The first adds an additional (empty) line and the second only ends the line as in Word.

I can imagine that there is a solution with ALT GR. Normaly it's possible to enter additional symbols
with ALT GR + a number, e.g. "123". I hoped that there was an additional symbol for SPACE,
which could be used instead of the common SPACE (by pressing the SPACE-Key) in batch-files.

Has anyone heard of something like this?
"dir /x" works. But if there is something as I mentioned, I would prefer it (because it can be used
in more situations).
User avatar
XnTriq
Moderator & Librarian
Posts: 6354
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: folder name with spaces

Post by XnTriq »

Well, you heard the man:
SS64 (Windows CMD » Syntax » [url=http://www.ss64.com/nt/syntax-args.html]Parameters / Arguments[/url]) wrote:Note on short file/folder names:
There is a bug involving the ~s option - the displayed output may be wrong if the current directory name is not the same as the short (8.3) name of the directory.
A workaround is to run command.com /c rem which will change the current directory to 8.3, details here.