directory

Deleting a directory results in application restart

寵の児 提交于 2019-12-17 16:39:39
问题 I have an application with 2 directories (books and export). If we create a book or a page of a book in the application a directory is added with the id of the page (this is for uploading resources). If we delete a page, the page (and it's directory) is removed from the database and the filesystem. However this resulted in a session loss (even an application restart). I've looked up some thing on google and found the following link. It seems to be a problem in ASP.NET 2.0 (and 3.5). Does

Difference Between getcwd() and dirname(__FILE__) ? Which should I use?

本小妞迷上赌 提交于 2019-12-17 16:05:31
问题 In PHP what is the difference between getcwd() dirname(__FILE__) They both return the same result when I echo from CLI echo getcwd()."\n"; echo dirname(__FILE__)."\n"; Returns: /home/user/Desktop/testing/ /home/user/Desktop/testing/ Which is the best one to use? Does it matter? What to the more advanced PHP developers prefer? 回答1: __FILE__ is a magic constant containing the full path to the file you are executing. If you are inside an include, its path will be the contents of __FILE__ . So

Difference Between getcwd() and dirname(__FILE__) ? Which should I use?

↘锁芯ラ 提交于 2019-12-17 16:05:08
问题 In PHP what is the difference between getcwd() dirname(__FILE__) They both return the same result when I echo from CLI echo getcwd()."\n"; echo dirname(__FILE__)."\n"; Returns: /home/user/Desktop/testing/ /home/user/Desktop/testing/ Which is the best one to use? Does it matter? What to the more advanced PHP developers prefer? 回答1: __FILE__ is a magic constant containing the full path to the file you are executing. If you are inside an include, its path will be the contents of __FILE__ . So

Comparing folders and content with PowerShell

与世无争的帅哥 提交于 2019-12-17 15:42:27
问题 PowerShell noob here. I have two different folders with xml files. One folder (folder2) contains updated and new xml files compared to the other (folder1). I need to know which files in folder2 are new/updated compared to folder1 and copy them to a third folder (folder3). What's the best way to accomplish this in PowerShell? 回答1: OK, I'm not going to code the whole thing for you (what's the fun in that?) but I'll get you started. First, there are two ways to do the content comparison. The

Comparing folders and content with PowerShell

跟風遠走 提交于 2019-12-17 15:42:02
问题 PowerShell noob here. I have two different folders with xml files. One folder (folder2) contains updated and new xml files compared to the other (folder1). I need to know which files in folder2 are new/updated compared to folder1 and copy them to a third folder (folder3). What's the best way to accomplish this in PowerShell? 回答1: OK, I'm not going to code the whole thing for you (what's the fun in that?) but I'll get you started. First, there are two ways to do the content comparison. The

How to delete a directory and its contents in (POSIX) C? [duplicate]

心已入冬 提交于 2019-12-17 15:39:57
问题 This question already has answers here : Removing a non empty directory programmatically in C or C++ (9 answers) Closed 2 years ago . I am most interested in the non-recursive case, but I am guessing others who might track this question would prefer seeing the recursive case. Basically, we are aiming to accomplish: rm -rf <target> However, a system call would be an immature answer. 回答1: You need to use nftw() (or possibly ftw()) to traverse the hierarchy. You need to use unlink() to remove

JAVA_HOME directory in Linux

这一生的挚爱 提交于 2019-12-17 15:34:59
问题 Is there any linux command I could use to find out JAVA_HOME directory? I've tried print out the environment variables ("env") but I can't find the directory. 回答1: echo $JAVA_HOME will print the value if it's set. However, if you didn't set it manually in your startup scripts, it probably isn't set. If you try which java and it doesn't find anything, Java may not be installed on your machine, or at least isn't in your path. Depending on which Linux distribution you have and whether or not you

how to create a folder in android External Storage Directory?

巧了我就是萌 提交于 2019-12-17 15:33:18
问题 I cannot create a folder in android External Storage Directory. I have added permissing on manifest, <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Here is my code: String Path = Environment.getExternalStorageDirectory().getPath().toString()+ "/Shidhin/ShidhiImages"; System.out.println("Path : " +Path ); File FPath = new File(Path); if (!FPath.exists()) { if (!FPath.mkdir()) { System.out.println("***Problem creating Image folder " +Path ); } } 回答1: Do it like

Iterating through files in a folder with nested folders - Cocoa

孤街醉人 提交于 2019-12-17 15:06:45
问题 I need to access every file in a folder, including file that exist within nested folders. An example folder might look like this. animals/ -k.txt -d.jpg cat/ -r.txt -z.jpg tiger/ -a.jpg -p.pdf dog/ -n.txt -f.jpg -p.pdf Say that I wanted to run a process on every file within "animals" that isn't folder. What would be the best way to iterate through the folder "animals" and all of its subfolders to access every file? Thanks. 回答1: Use NSDirectoryEnumerator to recursively enumerate files and

Handling directories with spaces Python subprocess.call()

落花浮王杯 提交于 2019-12-17 12:46:28
问题 I'm trying to create a program that scans a text file and passes arguments to subprocess. Everything works fine until I get directories with spaces in the path. My split method, which breaks down the arguments trips up over the spaces: s = "svn move folder/hello\ world anotherfolder/hello\ world" task = s.split(" ") process = subprocess.check_call(task, shell = False) Do, either I need function to parse the correct arguments, or I pass the whole string to the subprocess without breaking it