standsure Posted March 17, 2008 Share Posted March 17, 2008 I am relatively new to php, so apologies for my lack of finesse in coding, etc. I wanted to get information of files and folders on a specific drive. With the help of php sites like this I found various ways of getting what I need. One such example: <?php // list the files in C default directory echo "Default list: <br>"; print_r(glob('*.*')); var_dump(getcwd()); // change to D drive echo "<br> D Drive: <br>"; var_dump(chdir('D:')); var_dump(getcwd()); print_r(glob('*')); // change to E drive echo "<br> E Drive: <br>"; var_dump(chdir('E:')); var_dump(getcwd()); print_r(glob('*')); ?> However, when I look at my E drive nothing is returned. No matter what I do I cant get php to show me what is in E. Any ideas on why C & D are ok but E is a problem (I have checked permissions and all drives are set the same). Any help greatly appreciated… Link to comment https://forums.phpfreaks.com/topic/96515-newbie-problme-with-chdir-getcwd/ Share on other sites More sharing options...
standsure Posted March 17, 2008 Author Share Posted March 17, 2008 The output of code example: Default list: Array ( [0] => AccessDenied.aspx [1] => AccessDenied.aspx.cs [2] => Admin.aspx [3] => Admin.aspx.cs [4] => AllPages.aspx [5] => AllPages.aspx.cs [6] => Category.aspx [7] => Category.aspx.cs [8] => Default.aspx [9] => Default.aspx.cs [10] => Diff.aspx [11] => Diff.aspx.cs [12] => Directory.php [13] => Edit.aspx [14] => Edit.aspx.cs [15] => Error.aspx [16] => Error.aspx.cs [17] => FileList.ascx [18] => FileList.ascx.cs [19] => GPL.txt [20] => GetFile.aspx [21] => GetFile.aspx.cs [22] => GetThumb.aspx [23] => GetThumb.aspx.cs [24] => Global.asax [25] => History.aspx [26] => History.aspx.cs [27] => Import.aspx [28] => Import.aspx.cs [29] => InputPage.php [30] => InputPage_old.php [31] => JsFileTree.ascx [32] => JsFileTree.ascx.cs [33] => JsImageBrowser.ascx [34] => JsImageBrowser.ascx.cs [35] => Language.aspx [36] => Language.aspx.cs [37] => LogList.ascx [38] => LogList.ascx.cs [39] => Login.aspx [40] => Login.aspx.cs [41] => MasterPage.master [42] => MasterPage.master.cs [43] => Message.aspx [44] => Message.aspx.cs [45] => MySqlWeb.php [46] => MySqlWebResults.php [47] => MySqlWebResults2.php [48] => NavPath.aspx [49] => NavPath.aspx.cs [50] => Operation.aspx [51] => Operation.aspx.cs [52] => PageNotFound.aspx [53] => PageNotFound.aspx.cs [54] => Post.aspx [55] => Post.aspx.cs [56] => Preview.aspx [57] => Preview.aspx.cs [58] => Print.aspx [59] => Print.aspx.cs [60] => Profile.aspx [61] => Profile.aspx.cs [62] => RSS.aspx [63] => RSS.aspx.cs [64] => RandPage.aspx [65] => RandPage.aspx.cs [66] => Register.aspx [67] => Register.aspx.cs [68] => Search.aspx [69] => Search.aspx.cs [70] => SessionRefresh.aspx [71] => SessionRefresh.aspx.cs [72] => Thumbs.db [73] => Upload.aspx [74] => Upload.aspx.cs [75] => WebSols.php [76] => WebSolsStatus.php [77] => WebSols_Count_Status.php [78] => Zip.aspx [79] => Zip.aspx.cs [80] => index.htm [81] => nagios.php [82] => phpMyAdmin-2.11.4-all-languages-utf-8-only [83] => results.php [84] => results_old.php [85] => robots.txt [86] => test.php [87] => test1.php [88] => web.config ) string(27) "C:\Inetpub\wwwroot\PerfWiki" D Drive: bool(true) string(3) "D:\" Array ( [0] => System Volume Information [1] => Test ) E Drive: bool(true) string(3) "E:\" Array () Link to comment https://forums.phpfreaks.com/topic/96515-newbie-problme-with-chdir-getcwd/#findComment-493906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.