Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete Folders
Message
From
21/10/2005 01:01:26
 
 
To
17/10/2005 04:49:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 6 SP3
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01059540
Message ID:
01060978
Views:
10
Dear Professor

I made some amendments in your codes and now it works fine on windows XP. But it does not work on Windows 98. In win98 it show following error message

MESSAGEBOX("could not delete the directory: "+mypath)

Please modify to work on Win98
* FINAL
PUBLIC mypath
STORE space(100) to mypath

SET Date Dmy
LOCAL ldFolder,lcBaseFolder
LOCAL Array aFolders[1]
lcBaseFolder = 'e:\GinBackup'
FOR ix=1 To Adir(aFolders,Addbs(m.lcBaseFolder)+'*',"D")
	ldFolder = Ctod(Transform(aFolders[m.ix,1], '@R 99/99/9999'))
	IF !Empty(m.ldFolder) And m.ldFolder < Date()-7
		ERASE (Addbs(m.lcBaseFolder)+Addbs(aFolders[m.ix,1])+'*.*')
		mypath=(Addbs(m.lcBaseFolder)+aFolders[m.ix,1])
		DO d:\gin2006\progs\rdir
		*RD (Addbs(m.lcBaseFolder)+aFolders[m.ix,1])
	ENDIF
ENDFOR
mypath = ADDBS(ALLTR("E:\GINBACKUP"))

LOCAL lstfiles[1], dirnum,i

dirnum = adir(lstfiles,mypath+"\*.*","D")
FOR i = 3 to dirnum
	IF "D"$lstfiles(i,5)
		a=lstfiles(i,1)
			thisform.list1.additem(a)
	ENDIF
NEXT
and the codes in RD prg are as below
SET safety off
*mypath=GETDIR()
IF EMPTY(mypath)
	RETURN .T.
ENDIF
=getfolders(mypath)
IF !DIRECTORY(mypath)
	RETURN .T.
ELSE
	MESSAGEBOX("could not delete the directory: "+mypath)
ENDIF

FUNCTION getfolders
PARAMETERS mypath
LOCAL lstfiles[1], dirnum,i
dirnum = adir(lstfiles,mypath+"\*.*","D")
FOR i = 3 to dirnum
	IF "D"$lstfiles(i,5)
		getfolders(mypath+"\"+lstfiles(i,1))
	ENDIF
NEXT
ON error do fileerror
Delete file (mypath+"\*.*")
RD (mypath)
ON error
RETURN(.t.)

PROCEDURE fileerror
myError = 1
RETURN
Previous
Reply
Map
View

Click here to load this message in the networking platform