Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Executing long Directory Command in DOS
Message
From
17/12/2013 11:54:37
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
16/12/2013 12:10:39
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01590257
Message ID:
01590501
Views:
41
Have you tried calling gswin32c from the DOS command line using your long file names enclosed in quotes? Before you try to automate in FoxPro, I strongly suggest when debugging you limit yourself to the basics of the problem. If the long file names cannot work at all with gswin32c then you need to look at alternatives.
>I tried it
>
>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
>
>
>
>But got errors. Please Explain the usage with Example in my case
>
>Thanks
>
>
>>>The command inside is
>>
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
>>
>>Generate the output files to some temporary location, and then rename them afterward. Use this to get the short filename:
>>
>>
* 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)
>>
>>
>>
>>>My problem is that the input and output path being Long folder names as (perhaps more than 8 character)
>>>the process dont work.When I change the folder name to small one it works fine.
>>>
>>>But manually it is not possible to change name of thousnds of such folder.
>>>
>>>What is to be done. Any alternative ?
>>>
>>>Also one more related issue. The above conversion process is taking huge time , I am working on 32 Bit windows XP.
>>>Will my Migration to 64 Bit Win-7 and 8 will enhance my above speed of conversion.
>>>If yes, than how much time(if any Idea)
>>>
>>>Kinldy Guide
>>>Regards
Previous
Reply
Map
View

Click here to load this message in the networking platform