Looping through files inside a directory
I haven't been able to find anything to accomplish what I am trying to do. I don't know if it is possible, either. The goal is to loop through every file inside a directory, and grab the names of all the files inside it.
Any help and/or advice is appreciated! |
Re: Looping through files inside a directory
As bubka3 recommended: https://forums.alliedmods.net/showthread.php?p=602270
Code:
|
Re: Looping through files inside a directory
It should be okay, if you are not doing tons of file operations. I'd not recommend looking through the sprays / download directory.
Anyhow, you should never need to search through a directory. It would be better to use keyvalues and store relevant info there.. Or of need be, sql. Or at the very least, use these as indices/caches for your files so you don't have to search directories. |
Re: Looping through files inside a directory
Like friagram said, finding file isnt a big deal but if you going to read/write to every single files and that you have a tons of them, this could be a issue.
|
Re: Looping through files inside a directory
Yeah, I thought about doing KeyValues for it. I'll try this method first. I will end up limiting how many files a client can have, so it won't get too outrageous to loop through them.
Thanks for the help. I should have thought to look at SM Downloader :| ** Edit ** Problem is resolved. The snippet from SM Downloader go the job done. Thanks! |
Re: Looping through files inside a directory
Yeah my bad when i was using this I forgot i had a sum over 5,000 and more files.
|
All times are GMT -4. The time now is 06:24. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.