erase files - Resolved!!

Re: erase files

Postby Silvio.Falconi » Thu Jan 25, 2024 5: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: erase files

Postby solving » Thu Jan 25, 2024 6: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[i][1] )

fai un display della variabile cFILE se comprende il path completo + \ , es. c:\mydir\temp2.cdx o vedi solo temp2.cdx
solving
 
Posts: 65
Joined: Fri Jun 05, 2009 7:55 am
Location: Sicily ( ct ) - Italy

Re: erase files

Postby Silvio.Falconi » Thu Jan 25, 2024 6: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: erase files

Postby Otto » Thu Jan 25, 2024 7: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.

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: erase files

Postby solving » 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
solving
 
Posts: 65
Joined: Fri Jun 05, 2009 7:55 am
Location: Sicily ( ct ) - Italy

Re: erase files

Postby Silvio.Falconi » 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[i][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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 60 guests