?
Solved

directory delete in VFP9 sp2

Posted on 2010-01-10
3
Medium Priority
?
302 Views
Last Modified: 2012-08-13
Hi Experts
I have a backup folder and everytime I do a backup I create new folder within backup folder and copy files to the new folder. What I like to do  is, delete the folders  that were created before certian date. (i.e delete older backup folders)
Thanks.
0
Comment
Question by:Balbirlally
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Expert Comment

by:Allister_Reid
ID: 26277581
Hi,
you can use the following:

fso = CREATEOBJECT("Scripting.FileSystemObject")
fso.DeleteFolder("c:\temp\test")

Replace the path "c:\temp\test" with the directory you wish to delete.


Regards
0
 
LVL 42

Accepted Solution

by:
pcelba earned 2000 total points
ID: 26277609
You have to test the folder date, at least...
LOCAL lcDir, ldDate, lnDcnt, lnI, laDirList[1], llSafety
lcDir = "D:\temp"
ldDate = DATE()-14

llSafety = SET("SAFETY") = "ON"
SET SAFETY OFF

lcDcnt = ADIR(laDirList, ADDBS(lcDir)+"*.*", "D")

FOR lnI = 1 TO lcDcnt
  
  IF INLIST(laDirList(lnI, 1), ".", "..") OR ! "D" $ laDirList(lnI, 5)
    LOOP
  ENDIF
  
  IF laDirList(lnI, 3) < ldDate
    ERASE (ADDBS(lcDir) + laDirList(lnI, 1) + "\*.*")
    RD (ADDBS(lcDir) + laDirList(lnI, 1))
  ENDIF
  
NEXT

IF llSafety
  SET SAFETY ON
ENDIF

Open in new window

0
 

Author Closing Comment

by:Balbirlally
ID: 31675162
it works very well.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question