Hello,
I suppose it's logical that NConvert cannot handle file names with space. Is there any solution included in NConvert other than just use a tool to get rid of the spaces ?
[solved] file name with space
Moderators: XnTriq, helmut, xnview
-
- Posts: 228
- Joined: Wed Nov 24, 2004 8:53 pm
[solved] file name with space
Last edited by lian on Tue Mar 29, 2016 9:21 am, edited 1 time in total.
SF, illustrations et mes BD sur mon blog: https://www.li-an.fr/
Windows 10 Home 64 bits
Windows 10 Home 64 bits
-
- XnThusiast
- Posts: 4185
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: file name with space
There is a limitation, not well documented, on using quotes around filenames with spaces at the same time as using wildcards in inputs, but filenames with spaces can be processed in some circumstances.lian wrote:I suppose it's logical that NConvert cannot handle file names with spaces...
For example, the following code converts input files with spaces in the filenames from PNG to JPEG files with the same filename:
Code: Select all
nconvert -out jpeg -o Output\%.jpeg Input\*.png
a 00.png
a 01.png
a 02.png
a 03.png
Output files:
a 00.jpg
a 01.jpg
a 02.jpg
a 03.jpg
What do you need to do?
-
- XnThusiast
- Posts: 4185
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: file name with space
Edit:
That code was run in a situation where relative addressing could be used, so it is not an ideal example...
The following code is a better basic example:
That code was run in a situation where relative addressing could be used, so it is not an ideal example...
The following code is a better basic example:
Code: Select all
nconvert -out jpeg -o %.jpeg *.png
-
- Posts: 228
- Joined: Wed Nov 24, 2004 8:53 pm
Re: file name with space
OK, I've got this - XYplorer scripting with NConvert
The files with spaces in names are not taken in count.
Code: Select all
foreach($file, "<get SelectedItemsPathNames |>") {
$script= '"C:\Program Files\nconvert\nconvert.exe" '."-ratio -rtype lanczos -rflag orient -quiet -resize longest 950 -out jpeg -o E:\images\Output\%.jpg"." $file";
run $script;
wait 1000;
}
end confirm ("Allez à Output ?") == 0;
goto "E:\images\Output";
SF, illustrations et mes BD sur mon blog: https://www.li-an.fr/
Windows 10 Home 64 bits
Windows 10 Home 64 bits
-
- XnThusiast
- Posts: 4185
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: file name with space
I'm not familiar with XYexplorer but if you simply need to use NConvert code to process a directory of images, you could try code derived from the code I posted, but using full paths if necessary.
Note that in a Windows batch file the '%' in your code would need to be doubled to escape the character, if that could be relevant to your problem??
In case of a problem with wildcards and spaces, a FOR loop might ultimately provide a workaround.
Note that in a Windows batch file the '%' in your code would need to be doubled to escape the character, if that could be relevant to your problem??
In case of a problem with wildcards and spaces, a FOR loop might ultimately provide a workaround.
-
- Posts: 228
- Joined: Wed Nov 24, 2004 8:53 pm
Re: file name with space
Thanks for your help. I will ask XYplorer forum how to clean the name before using XnConvert.
SF, illustrations et mes BD sur mon blog: https://www.li-an.fr/
Windows 10 Home 64 bits
Windows 10 Home 64 bits
-
- XnThusiast
- Posts: 4185
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: file name with space
Use of wildcards and quotes in input file names:
A number of previous posts have noted that NConvert input filenames can contain either wildcards or quotes around filenames containing spaces, but not both together.
It has become evident incidentally above that NConvert can, at least in some circumstances, accept filenames containing spaces without the filename being quoted, as in these examples:
Acceptance of filenames with spaces unquoted seems unexpected and counter intuitive, but if it works...
A number of previous posts have noted that NConvert input filenames can contain either wildcards or quotes around filenames containing spaces, but not both together.
It has become evident incidentally above that NConvert can, at least in some circumstances, accept filenames containing spaces without the filename being quoted, as in these examples:
Code: Select all
nconvert -out jpeg -o #.jpeg *.png
Code: Select all
nconvert -out jpeg -o %.jpeg *.png
-
- Posts: 228
- Joined: Wed Nov 24, 2004 8:53 pm
Re: file name with space
Thanks. I learned that XYplorer has some functions to "clean" filenames but I'm not a great coder. Maybe I will find something with your suggestions.cday wrote:Use of wildcards and quotes in input file names:
A number of previous posts have noted that NConvert input filenames can contain either wildcards or quotes around filenames containing spaces, but not both together.
It has become evident incidentally above that NConvert can, at least in some circumstances, accept filenames containing spaces without the filename being quoted, as in these examples:
Code: Select all
nconvert -out jpeg -o #.jpeg *.png
Code: Select all
nconvert -out jpeg -o %.jpeg *.png
SF, illustrations et mes BD sur mon blog: https://www.li-an.fr/
Windows 10 Home 64 bits
Windows 10 Home 64 bits
-
- XnThusiast
- Posts: 4185
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: file name with space
Note that the above statements refer to the use of filenames containing spaces when the folder name either needn't be specified, or does not contain spaces.
The limitation on using wildcards and spaces together referred to above relates to folder paths containing spaces: if wildcards are needed in input file names, avoid using paths containing spaces... [Alternatively, a FOR loop in a batch file may provide a solution.]
The limitation on using wildcards and spaces together referred to above relates to folder paths containing spaces: if wildcards are needed in input file names, avoid using paths containing spaces... [Alternatively, a FOR loop in a batch file may provide a solution.]
-
- Posts: 228
- Joined: Wed Nov 24, 2004 8:53 pm
Re: file name with space
OK, solved using a "rename" function from XYplorer - very easy to do.
SF, illustrations et mes BD sur mon blog: https://www.li-an.fr/
Windows 10 Home 64 bits
Windows 10 Home 64 bits