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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backing up text files

Status
Not open for further replies.

PaidtheUmpire

Programmer
Jan 4, 2004
105
AU
Is there a way to move a file from directory

C:/folder/
to
C:/folder/extras/

one done with?
 
Here it is from WinApi

The MoveFile function renames an existing file or a directory (including all its children).

BOOL MoveFile(

LPCTSTR lpExistingFileName, // address of name of the existing file
LPCTSTR lpNewFileName // address of new name for the file
);


Parameters

lpExistingFileName

Points to a null-terminated string that names an existing file or directory.

lpNewFileName

Points to a null-terminated string that specifies the new name of a file or directory. The new name must not already exist. A new file may be on a different file system or drive. A new directory must be on the same drive.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The MoveFile function will move (rename) either a file or a directory (including all its children) either in the same directory or across directories. The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume.

See Also

CopyFile, MoveFileEx

Alternatively
read into string and write to new file and delete old file
 
WinAPI is the interface to Windows functionality. An API is an Application Programming Interface.

Windows uses DLL's which contain general Window functions, some of the functions are exported and can be directly used in your Delphi program bij using the WinAPI (see the WIN32 SDK help files), as mentioned in the previous mail.

The Windows functions mentioned in the Win 32SDK, can directly be used in your application, they are integrated in the Borland development environment.



Good luck,

Mark.
PAC Greenware
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top