FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour erase files - Resolved!!
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: erase files
Posted: Thu Jan 25, 2024 05:31 PM
Otto wrote:Who created the cdx files. Which user account.
I created the files cdx with account administrator , It Is the last One account on my PC
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 65
Joined: Fri Jun 05, 2009 07:55 AM
Re: erase files
Posted: Thu Jan 25, 2024 06:02 PM
LOCAL xPath := "C:\PDF\"

* --- Elimina File che Iniziano con CLI_...PDF
AEVAL(DIRECTORY(xPath + "CLI_*.PDF"),{|aFile|FERASE(xPath + aFile[F_NAME])} )


nel tuo comando :
cFILE := ALLTRIM( aDIR[1] )

fai un display della variabile cFILE se comprende il path completo + \ , es. c:\mydir\temp2.cdx o vedi solo temp2.cdx
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: erase files
Posted: Thu Jan 25, 2024 06:09 PM

Ho messo un trace msginfo(ferror,cfile)

Tutti e due i messaggi viene visualizzato l'errore 5 , il primo mi dà "." e il secondo ".." è sta cosa che non ho capito.

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: erase files
Posted: Thu Jan 25, 2024 07:45 PM
Insert a msginfo() before you delete the files and check with "Resource Monitor" the "Assoiated Handles" of your file.

Open the Start menu, type "Resource Monitor" and press Enter.
Switch to the "CPU" tab.
Expand the "Associated Handles" section in the lower panel.
In the search field of the "Associated Handles" section, enter the name of the file you want to check. If the file is being used, it will appear in the list along with the process using it.

Posts: 65
Joined: Fri Jun 05, 2009 07:55 AM
Re: erase files
Posted: Fri Jan 26, 2024 10:42 AM

la sintassi :

aDir := DIRECTORY(cDir+ ".", "D" )

include nell'array anche i "." e ".."

aDIR[1,1] = "."

aDIR[2,1] = ".."

se usi :

aDir := DIRECTORY(cDir+ "." ) , non verranno inglobati "." e ".."

se usi il parametro "D" allora devi controllare il contenuto dell'array

IF cFile <> "." .OR. cFile <> ".."

IF FErase(cDir+cFile ) != 0

 ? FERROR()

ENDIF

ENDIF

consiglio 1 : senza parametro "D"

consiglio 2 : metti il path -> cDir + cFile

Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: erase files
Posted: Fri Jan 26, 2024 11:13 AM
ecco dov'era l'errore il parametro D

static Function Cancella_Archivi(cDir)
local adir := DIRECTORY(cDir+ "*.*" )
local i,cFile

FOR i = 1 to LEN( aDir )
cFILE := ALLTRIM( aDIR[1] )
IF FErase(cDir+cFile ) != 0
Msginfo( FERROR() ,cfile)
endif
NEXT
return nil
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion