Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excluding files from the DIRECTORY() function 1

Status
Not open for further replies.

Elkari

Programmer
May 1, 2001
144
US
I have a function that would clean up old files from various directories. In one directory certain files should never be deleted. This is causing a problem with DIRECTORY() because it is trying to create a file array that contain more than 4096 elements for that directory.

Is there a DIRECTORY() like function would exclude listing files of a certain type set by a mask?

Thanks for your response.
 
Nope...I have exhusted all my ideas how to do this and was just waiting to see if anyone else tried or did anything like this. I did not think I would ever hear from anyone after one month past.

Thanks for asking about this!!!
 
With barely my first morning coffee behind me, I offer this idea...
1. create a new dbf that holds the names of the files you wish to not delete. Because it's a dbf, it can hold as many file names as you need. If this list of files is short, you could do same thing hard coded and not maintain a seperate dbf..
2. make a new function that calls directory() and passes a parameter to it. The 1-char parameter would be A-Z and 0-9 and represent the fist letter of the file extension.
Example... ADIR( "*.A*", aFiles) would build an array of *.A* named files.
When Dircetory if finished on that character, test the array for any instances of reserved file names (from #1 above) and remove them from the array.
3. Delete whatever files meet your deletion criteria as listed in this array.
4. Repeat for B-Z and 0-9
Good luck
 
Thanks Reipula and Circes9 for each of your suggestions. Unforntunately I busy will another programming 'emergency' and will not be able to try either suggestion for a while. I'll let you know how they worked when I can.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top