Page 1 of 1

looking for some logic

Posted: Sun Jun 12, 2005 1:00 am
by s.dot
I have a folder containing a lot of directories.

The directories are named for each member that has signed up on my site.

Before I had my deletion set up properly, some people deleted their accounts and their pictures and directories are still on my server wasting space.

How could I loop through the usernames and find only the directories that are not found in the username database?

I'm not looking for a code that would delete them, just echo them to me so I can do it manually. I'd prefer to do it that way.

Could someone give me some logic?

Posted: Sun Jun 12, 2005 2:15 am
by anjanesh
Use opendir() and is_dir() to traverse through directory names within a directory.

For your usernames stored in the database you'll need to query it and check each username's directory.
Sort it to save time.

Otherwise - if your usernames are less than 1000 - you can have the directory names in an array and the usernames from the database in another array and use array_diff_assoc() to find out the difference.