Hi All Friends ,
I need to delete the old cdx files before re-indexing ,
How can I execute the command delete file under HMG
Regards
Foued
How can I execute the command delete file under HMG
Moderator: Rathinagiri
- fouednoomen
- Posts: 188
- Joined: Sun Oct 14, 2012 8:33 am
- DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
- Location: Tunisia
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: How can I execute the command delete file under HMG
Hi Foued,
You do the same way as have been done in Clipper or Harbour.
There are many ways like, but before I think is better to check if is existing file and second if file is accessable for delete. Because some time files are open (in low level) but not able for deleting. You can check if that file can be able for deleting.
You can use for deleting:
or
You can do a routine to check file condition by FOPEN. Please note it conditions table:
MsgStop("File cdx can not be deleted")
else
ferase(fileName)
Endif
I hope it has been clear for you. In case you have other dificulties, please return back with your questions.
You do the same way as have been done in Clipper or Harbour.
There are many ways like, but before I think is better to check if is existing file and second if file is accessable for delete. Because some time files are open (in low level) but not able for deleting. You can check if that file can be able for deleting.
You can use for deleting:
Code: Select all
Delete File("Name_File")Code: Select all
#include "fileio.ch"
IF FErase( "test.txt" ) != F_ERROR
? "File successfully erased"
ELSE
? "File can not be deleted"
ENDIFif (nInfile := FOPEN(fileName, FO_READ+FO_EXCLUSIVE))<0CA-Clipper Tools » Books 1-3 » Book2 » Disk Utilities » wrote:Table 7-11: Coding the File Attribute
--------------------------------------------------------------------------------------
MsgStop("File cdx can not be deleted")
else
ferase(fileName)
Endif
I hope it has been clear for you. In case you have other dificulties, please return back with your questions.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- fouednoomen
- Posts: 188
- Joined: Sun Oct 14, 2012 8:33 am
- DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
- Location: Tunisia
Re: How can I execute the command delete file under HMG
Many Thanks My Friend
it's run
Foued
it's run
Foued