alko123 Posted September 7, 2007 Share Posted September 7, 2007 Hi. how can i extract only the first file from a directory? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 7, 2007 Share Posted September 7, 2007 http://uk2.php.net/manual/en/function.readdir.php look at example 499 and 500. all you need to do is break out of the loop once you hit your file. Quote Link to comment Share on other sites More sharing options...
alko123 Posted September 7, 2007 Author Share Posted September 7, 2007 http://uk2.php.net/manual/en/function.readdir.php look at example 499 and 500. all you need to do is break out of the loop once you hit your file. but the file names will be every time different. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 7, 2007 Share Posted September 7, 2007 look - there is the code to go through a directory - the second example shows youhow to ignore . and .. the rest is up to you - you find the first file and do your stuff with it then exit the loop. how hard can that be? I don't know what your file names are and (I may be guessing here but) files in a file system tend to have different names and paths - the beauty if using those examples and modifying them for your needs is that you might learn something from itthat will help you in thr future. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.