||Re: deleting files in a remote directory
||Fri, 10 Aug 2018 09:31:05 -0400
I never understood arrays before. This is cool! Thanks.
Ken Mayer Wrote:
> On 8/9/2018 5:24 PM, Charlie wrote:
> > Hi Ken.. Does this mean there is no way to delete files from a directory unless you know the file names?
> Well, your code needs to know the file names, yes. But you don't need to
> You use an array (untested, but something along these lines):
> aFiles = new array()
> aFiles.dir( "C:\SomeFolder\*.jpg" )
> // default is five columns, so size/5 gives the number of
> // files in the array
> for i = 1 to aFiles.size/5
> // array has five columns, you want the current row (i), and the
> // first column, which should be the filename ...
> delete file "C:\SomeFolder\" + aFiles[i, 1]
> // no need to do what you were doing with a file object
> *Ken Mayer*
> Ken's dBASE Page: http://www.goldenstag.net/dbase
> The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
> dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
> dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm