Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fox Pro and Dos under windows 2k
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00671184
Message ID:
00671790
Views:
18
>> Code may have macros in the picture.
>>
>> example
>> OldFile = 'c:\windows\test.txt'
>> NewFile = 'C:\mydir\newtest_on_my_directory.txt'
>>
>> run copy &OldFile to &NewFile
>>
>> It does not complete the copy command.
>
>First, the DOS COPY command does not take a 'to' intermediary - the syntax would be something like:
>
>RUN COPY &OldFile &NewFile
>
>but that isn't going to work...
>
>COPY is an internal command - there is no COPY.COM or COPY.EXE for RUN to execute. The easiest ways to address this are (1) to explicitly launch a new instance of the CLI, or (2) encapsulate the command in a batch file, and use RUN to fire the .BAT file. Other options exist - using a COM option like the WSH Scripting.FileSystemObject or Shell.Application to perform the copy operation, use of the VFP COPY FILE command, or any of several Win API calls like CopyFile() or SHFileOperation() to replace the DOS command under RUN are all probably worth considering.

He said it's within a FoxPro DOS program...

If not for the long file names, the simplest solution would be to switch from the DOS COPY command to a FoxPro COPY FILE command. But FoxPro 2.x automatically truncates any long file names to 8.3 before executing the command.

As it is,
!COPY &OldFile &NewFile
should work, as long as you've put quotes in the string variables around the long file names, i.e.
OldFile = ["C:\Dir\SubDir\My Long FileName.txt"]
NewFile = ["C:\New Dir Long Name"]
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing
Previous
Reply
Map
View

Click here to load this message in the networking platform