Closed soubhikchatterjee closed 3 years ago
@soubhikchatterjee Since bash
has no such limit, it looks like you ran into https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation.
If you need to do such path lengths regularly over multiple systems, that link also gives the official syntax change (\\?\
prefix) needed to handle such extreme path lengths.
There's also the next section (https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#enable-long-paths-in-windows-10-version-1607-and-later), which gives 1 the ability to per system enable longer paths, given a late-enough version of Win10 & sufficient access to modify a registry key (HKLM\SYSTEM\CurrentControlSet\Control\FileSystem:LongPathsEnabled(REG_DWORD)=1
) or group policy (Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths
) & then reboot.
Thanks for replying @TPS
Here is something I found out, if I remove the quotes from the paths, it works, but with a quote, it doesn't work. But again, if a file has space in between for eg "my file.pdf", it fails again.
So to summarize
How do I execute the merge command successfully for files that has spaces? Pls help
@soubhikchatterjee Are you running these commands via scripting (.bat
, .cmd
, &c) or directly from Cmd
?
I have tried running this script from cmd as well as nodejs's exec-sh module and both have resulted in the same error.
I have raised the same question in StackOverflow and someone commented that it is cpdf.exe's responsibility to parse the quotes.
I am not sure what to do and how to make it work at the moment. I am using cpdf in one of my clients major project.
I think the answers you received from that 1 person are mostly wrong, but not completely. https://stackoverflow.com/questions/562038/escaping-double-quotes-in-batch-script seems to have the most correct answers I can find quickly.
I can confirm that this is not a problem with cpdf in particular. Cpdf does no processing of filenames at all. You can see what filenames are arriving to cpdf by using cpdf -debug ...
For example:
gorge:cpdf-source john$ cpdf -debug cpdfmanual.pdf
arg: cpdf
arg: -debug
arg: cpdfmanual.pdf
gorge:cpdf-source john$ cpdf -debug "cpdfmanual.pdf"
arg: cpdf
arg: -debug
arg: cpdfmanual.pdf
Ask your customer if they have a support contract with us (assuming they have purchased cpdf). If so, you can write direct to support@coherentgraphics.co.uk. However, as I say, this particular problem is not due to cpdf.
I am using cpdf on windows to merge pdf files.
When I am trying to merge two files using absolute path on windows default command prompt, it fails with the following error
and i am using the following command to merge two files
C:\PROJECTS\lens-desktop\public\libs\cpdf\win64\cpdf.exe 'C:\Users\john\Documents\__Docs__\a70c494b04c8305d27a3a8b81c0d6b15\lens\new\Keytronic_AED_Keyboard_Schematic_1982.pdf' 'C:\Users\john\Documents\__Docs__\a70c494b04c8305d27a3a8b81c0d6b15\lens\new\107193-F_QBus_18b_Intf.pdf' -o 'C:\Users\john\Documents\__Docs__\a70c494b04c8305d27a3a8b81c0d6b15\lens\new\107178-L_QBus_16b_Intf__Merged.pdf'
However, it merges these pdf files successfully if i run the command on GIT BASH.
Is this a problem with cpdf or my path?
thanks