Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Long filenames and the run command
Message
From
29/07/1999 11:32:41
 
 
To
29/07/1999 11:11:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00247690
Message ID:
00247707
Views:
18
>Hi everybody,
>
>I am using pkzip to zip up some files in 2 (conditionally 3) directories. We recently gave our customers the ability to install our software using long directory names. That broke the following code:
>
>***************
>lcPath = goApp.InstallDirectory
>
>lcRunCmd = lcPath + 'pkzip.exe -P -& a:\bkup.zip + ;
> lcPath+'data\*.* ' + IIF(goApp.data4,lcPath + ;
> 'data\dbc4\*.* ','') + lcPath+ 'data\dbc3\*.* '
>
>&RUN lcRunCmd

part of the problem is that the line should read:

RUN &lcRunCmd

Some things to be aware of:

First, if an LFN contains a space, you MUST encapsulate the path in double quotes when passing it on the command line; IOW, if you want to reference the file:

C:\My Program\Some Directory\ a file name.txt

and put it in myZip.ZIp, the command line would have to read:

PKZIP -a MyZip "C:\My Program\Some Directory\ a file name.txt"

Second, PKZIP ius clueless about handling LFNs; you'll want to get the equivalent short file name for the long file name(s) or path(s) for use in your command line. There's sample code in the FAQ showing how to get the Short File Name of a Long File name using an API call (I wrote it) called How do I determine the Short version of a Long File Name under Win32 and Other APIs.

Good luck!


>
>****************
>
>goApp.InstallDirectory is the full path to the directory of the installation.
>
>goApp.data4 is a logical that is set if the data4 directory has data.
>
>
>This works unless they install to a directory using spaces. I tried adding this line right after lcpath=goApp.InstallDirectory
>
>lcPath='"'+lcPath
>
>thinking that you can, in a DOS box, change directories with spaces by typing --- cd\"my directory --- The problem with that is, when I get to the second use of lcPath in the command, the " closes the first quote. The command fails.
>
>As soon as I can get the time, I am switching to DynaZip, but for now I'm on a tight deadline. Any help would be REALLY appreciated. I'll buy you one of the free cokes at the Southern California Conference! :)
>
>By the way, I'm using VFP3.0.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform