directory

How can I save a directory tree to an array in PHP?

穿精又带淫゛_ 提交于 2019-12-12 23:10:39
问题 I'm trying to take a directory with the structure: top folder1 file1 folder2 file1 file2 And save it into an array like: array ( 'folder1' => array('file1'), 'folder2' => array('file1', 'file2') ) This way, I can easily resuse the tree throughout my site. I've been playing around with this code but it's still not doing what I want: private function get_tree() { $uploads = __RELPATH__ . DS . 'public' . DS . 'uploads'; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(

unable to Include Files php using include

邮差的信 提交于 2019-12-12 22:22:04
问题 I have a page called index.php which includes a page new_display.php which again includes two pages i.e. say x.php and y.php The include is working fine on localhost but not on my hosting! The error i am getting is :- Warning: require(/interests/sketching/udis.php) [function.require]: failed to open stream: No such file or directory in /hermes/bosweb/web054/b548/ipg.pingcampuscom/mysql/interests/sketching/new_display.php on line 154 Fatal error: require() [function.require]: Failed opening

In Ruby, how do I specify a file in another directory as an input?

こ雲淡風輕ζ 提交于 2019-12-12 22:19:33
问题 This probably has a simple answer, but I'm working on a test suite that requires an input file that is in a different folder. I'd like to use a relative path, like this: @graph = Graph.new('../lib/test_input.txt') But Ruby doesn't like that. What's the best way to use a relative file path like that? Thanks 回答1: If you mean relative to the current file, you'll probably want something like: @graph = Graph.new(File.expand_path(__FILE__, "../lib/test_input.txt")) If you mean relative to the

SVN merge just a directory add from a checkin (without directory contents)

不羁岁月 提交于 2019-12-12 21:21:47
问题 Am trying to merge (from a branch) a file in a directory that does not yet exist on trunk. Here is the example: Trunk (from which we branch) / /root1.txt /foo/foo1.txt Branch (after 2 checkins) / /root1.txt /foo/foo1.txt /bar/bar1.txt /bar/bar2.txt First checkin: A /bar A /bar/bar1.txt Second checkin: A /bar/bar2.txt Assuming the trunk hasn't changed, is it possible to get only /bar/bar2.txt into the trunk? Here are the solutions I have tried already: svn merge -rX:X+1 /path/to/branch/bar . -

Get TFS mapped folder of a local sub folder of the solution?

泄露秘密 提交于 2019-12-12 20:22:28
问题 Let's say we have a solution in TFS Source Control which has already been mapped to a local folder SolutionFolder . We are in a sub folder SubFolder of this SolutionFolder . How can we write C# code to get the mapped path of this SubFolder ? 回答1: Use the WorkStation.Current to grab the information for the folder in question: Import the following namespaces: using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.VersionControl.Client; and then use you can get to the data you

Is it possible to use opendir repeatedly in C?

房东的猫 提交于 2019-12-12 19:29:11
问题 I am trying to debug right now in C and am curious if it is alright to call opendir() repeatedly without having to first call closedir() because I am trying to run a loop to open sub-directories when the while-loop that calls readdir() encounters them. And I assume that closing the current directory would cause me to lose the ability to read it. 回答1: You can use opendir() repeatedly. Just keep your DIR * s and call closedir() when you're done with each. 回答2: Yes, you can do multiple opendir()

Linux/php require parent directory

五迷三道 提交于 2019-12-12 19:20:57
问题 I am on Ubuntu 11.10 and installed apache server to host my local website before i host it from a company. My website root location is "/home/a1a4a/www/" I have a php file in /home/a1a4a/www/account/account_info.php" That i want him to include a file in "/home/a1a4a/www/include/fg_membersite.php" It's what i did from account_info.php require_once('./include/fg_membersite.php'); And i got this error Warning: require_once(./include/fg_membersite.php): failed to open stream: No such file or

ignore “Unauthorized Access” “ function Directory.GetDirectories()”

坚强是说给别人听的谎言 提交于 2019-12-12 19:06:41
问题 When I scan The Directory in C:\\users\\<SomeUserName>\\* In some Directory i have no access i search a lot how to ignore "Unauthorized Access" Now i need Help :/ Here is my code: public void encryptDirectory(string location, string password) { //extensions to be encrypt var validExtensions = new[] { ".txt", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".odt", ".jpg", ".png", ".csv", ".sql", ".mdb", ".sln", ".php", ".asp", ".aspx", ".html", ".xml", ".psd" }; string[] files = Directory

How to create multiple directories given the folder names

我是研究僧i 提交于 2019-12-12 18:29:09
问题 I have a list of files, the names of these files are are made of a classgroup and an id (eg. science_000000001.java) i am able to get the names of all the files and split them so i am putting the classgroups into one array and the ids in another.. i have it so that the arrays cant have two of the same values. This is the problem, i want to create a directory with these classgroups and ids, an example: science_000000001.java would be in science/000000001/science_000000001.java science

How can HTML “link href” call same file from different folders?

半世苍凉 提交于 2019-12-12 18:28:58
问题 Here is my root folder : index.php stylesheets(folder) --->main.css includes(folder) --->header.php folder1 (folder) --->page1.php Here is link part of "header.php" (from includes folder) : <link href="stylesheets/main.css" rel="stylesheet" type="text/css" /> Here is a part of index.php : <?php include "includes/header.php"; ?> Here is a part of page1.php (from folder1): <?php include "../includes/header.php"; ?> Problem is, when I open index.php everything is normal. As for /folder1/page1