lcDir = "c:\mytemp\" MD &lcDir lcPdf = lcDir + sys(2015) + ".pdf" lcPs = FORCEEXT(lcPdf, "ps") * Run it !gswin32c.exe -sDEVICE="pdfwrite" -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -dSAFER -dQUIET -sOUTPUTFILE=&lcPdf &lcPs * Move both files lcPdf = lcDir + JUSTSTEM(lcPdf) !MOVE &lcPdf..p* "D:\COMP JAIPUR\20131106_20131101\100042\1005753165.*"Several ways to address this. You might be able to fix it by using -sOUTPUTFILE="file" with quotes around your lengthy filename.
>Call with: > lcShortFilename = getShortFilename('D:\COMP JAIPUR\20131106_20131101\100042\1005753165.Pdf') > ? "Short filename: " + lcShortFilename > >And also > lcShortFilename = getShortFilename('D:\COMP JAIPUR\20131106_20131101\100042\1005753165.Pdf'@llIsValid) > ? "Short filename: " + lcShortFilename > >>
gswin32c.exe -sDEVICE="pdfwrite" -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -dSAFER -dQUIET -sOUTPUTFILE=D:\COMP JAIPUR\20131106_20131101\100042\1001817119.Pdf D:\COMP JAIPUR\20131106_20131101\100042\1001817119.ps>>
* Call with: >>* lcShortFilename = getShortFilename(lcLongFilename, @llIsValid >>* IF llIsValid >>* ? "Short filename: " + lcShortFilename >>* ELSE >>* ? "Unable to determine short filename from: " + lcLongFilename >>* ENDIF >>FUNCTION getShortFilename >>PARAMETERS pcLongFilename, plValid >>LOCAL lcShortFilename, lnShortFilenameLength, lnReturnValue >> >> #DEFINE MAX_PATH 255 >> DECLARE INTEGER GetShortPathName IN Kernel32 STRING @lpszLongPath, STRING @lpszShortPath, INTEGER cchBuffer >> DECLARE INTEGER GetLastError IN Win32api >> >> IF EMPTY(pcLongFilename) >> pcLongFilename = FULLPATH(CURDIR()) >> ENDIF >> >> * buffer to receive converted file name >> lcShortFilename = SPACE(MAX_PATH) >> lnShortFilenameLength = LEN(lcShortFilename) >> >> * if successful, lnReturnValue will contain the length of the output string >> lnReturnValue = GetShortPathName(@pcLongFilename, @lcShortFilename, lnShortFilenameLength) >> IF lnReturnValue = 0 >> plValid = .F. >> RETURN "?? Unable to get the short path" >> ENDIF >> plValid = .T. >> >> * truncate it at the length the return value indicates >> RETURN LEFT(lcShortFilename, lnReturnValue) >>>>