Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cut files in foxpro code

Status
Not open for further replies.

David3

Programmer
Oct 28, 2002
7
ES
Hi!
very new to FoxPro , so if question is stupid -- sorry :)
I need to move files in foxpro from one location to another ... copy & delete those files -- is't good for me for some reasons .. What I need to do is either CUT or MOVE ...
Can anybody provide me with the syntax , please ?

Thanks to all
 
David3

Copy c:\text.txt TO c:\mydirectory\text.txt
DELETE FILE C:\TEXT.TXT
Mike Gagnon
 
David3

Copy FILE c:\text.txt TO c:\mydirectory\text.txt
DELETE FILE C:\TEXT.TXT
Mike Gagnon
 
David3

Sorry the second the additional "to" is required. Sorry. Mike Gagnon
 
As I said : copy&delete -- IT IS NOT AN OPTION ... I need to cut or move ...

thanx
 
David3

As I said : copy&delete -- IT IS NOT AN OPTION ... I need to cut or move ...

Sorry, didn't notice.
Mike Gagnon
 
Try "RENAME" command, including paths:

RENA ...\AAA\BBB\CCC.TXT TO DDD\CCC.TXT
 
David3

The only way I can think of is an API MoveFile call. The folowing sample creates a file and moves it.
Code:
DO movemyFile

lpFileName = "C:\Temp\mytest.txt" 
lpNewFileName = "C:\Temp\mytest1.txt" 

hFile = CreateFile (lpFileName, 0, 0, 0,; 
    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0) 

= CloseHandle (hFile) 
= MoveFile (lpFileName, lpNewFileName) 

PROCEDURE  movemyFile 
    DECLARE INTEGER MoveFile IN kernel32; 
        STRING lpExistingFileName,; 
        STRING lpNewFileName 

    DECLARE INTEGER CreateFile IN kernel32; 
        STRING  lpFileName,; 
        INTEGER dwDesiredAccess,; 
        INTEGER dwShareMode,; 
        INTEGER lpSecurityAttributes,; 
        INTEGER dwCreationDisposition,; 
        INTEGER dwFlagsAndAttributes,; 
        INTEGER hTemplateFile 

    DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject



Mike Gagnon
 
thanx Mike and evrybody ...you;ve been helpfull ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top