devxlogo

MoveFile command (Delphi 32)

MoveFile command (Delphi 32)

Question:
The MoveFile command does not work for me with some filenames. An example is as follows :

MoveFile(‘C:CIPLINCOMING199702110408440000000000.SAV’, ‘C:CIPLARCHIVE’);
yet, if I try to move a file called ‘test.sav’ with the same line, it works. In the first case – Delphi just refuses to move the file. It doesn’t crash.I looked up MoveFile – and it makes a direct call to kernel32.dll. I am using the updated version of Windows 95 (OSR2). Are there any alternatives to moving files? (i’ve tried CopyFile and DeleteFile – but that does not solve the problem either).

Answer:
You might try enclosing the entire path in double quotes, so your line readsas follows:

MoveFile(‘”C:CIPLINCOMING199702110408440000000000.SAV”‘,’C:CIPLARCHIVE’);
This is a Windows thing. Any 8.3 DOS format files will work, butdouble-quoting seems to solve a lot of these types of problems.

devx-admin

Share the Post: