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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare database entries to list of files in a folder on server

Status
Not open for further replies.

artdirectoreric

Instructor
Jun 26, 2001
120
0
0
US
To avoid using up all of the space available for one of my sites, I want to generate a list of images that I no longer need.

I want to be able to read the files in a directory, compile all of the entries in all of the databases on our site that call for those images and compare the two lists to generate a third list of unused images.

I can figure out how to generate a listing of all of the database entries pretty easily and I've created a page that will list all of the files in a folder, but I don't know where to start when it comes to comparing the two lists. If there's a way to dump the list of filenames into a table in the database then I should be good to go. Any thoughts or guidance from you good folks?
 
use 2 arrays example call them
FilesInDirArray
FilesInDatabaseArray

load them with your lists.loop through them and if the file in 1st array is never in second array remove it from the array and continue with the looping
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top