directory

Linux directory starting with dot

孤人 提交于 2019-12-23 10:15:53
问题 Is there anything special about directories which start with a dot . in Linux (Ubuntu), such as ~/.vim ? Thanks. 回答1: Files and directories whose names begin with a dot ( . ) by default are not displayed in directory listings by the standard command ls . Therefore, they are traditionally used to store settings, preferences, etc .. Directory ~/.vim in particular surely contains personal preferences and settings for the text editor vim . There are also two special directory names in this class:

zip main folder with sub folder inside

喜夏-厌秋 提交于 2019-12-23 10:11:25
问题 I have a folder with some files and sub folder inside. How im going to read the directory and zip the main folder? Ex: maindirectory --- file 1 --- file 2 --- subdirectory 1 ------ file 3 ------ file 4 --- subdirectory 2 ------ file 5 ------ file 6 I'm using this script: function Zip($source, $destination, $include_dir = false) { if (!extension_loaded('zip') || !file_exists($source)) { return false; } if (file_exists($destination)) { unlink ($destination); } $zip = new ZipArchive(); if (!$zip

what is __dirstream, where can we find the definition

跟風遠走 提交于 2019-12-23 09:47:17
问题 As we can see in dirent.h , there is a typedef: typedef struct __dirstream DIR; It says it's opaque to users. And we can't find it even in gcc headers, the __dirstream structure definition can only be found in glibc source code. I am wondering why this structure has to be opaque (I don't think it's plausible to say it prevents user from direct reference, probably I am wrong)? What's the catch? 回答1: You can find the actual definition here, but as has been pointed out you're not supposed to

How to get files in the subfolders too from directory

落爺英雄遲暮 提交于 2019-12-23 09:36:43
问题 Hi I have to get files from a specified path in the directory. This is the method I wrote but I didn't get the files from the subfolders. Private void getfiles(){ Directoryinfo info = new Directoryinfo(configurationmanager.appsettings["Targetroot"].tostring ()); if (info.exists){ Gvfiles.datasource = info.GetFiles(); Gvfiles.databind(); } } 回答1: You will want to include the SearchOption.AllDirectories. Example: info.GetFiles("*", SearchOption.AllDirectories); Reference: http://msdn.microsoft

Change Home Directory Ubuntu 14.10 [closed]

拈花ヽ惹草 提交于 2019-12-23 09:26:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm trying to change the home directory to a different folder and my OS is not letting me do that. In Ubuntu I try to edit the useradd file but I can't figure out any way to save my changes that I made. Does anyone know how to do this? 回答1: As root usermod -d /path/to/new/directory username Make sure your have

Moving files from one directory to another with Java NIO

丶灬走出姿态 提交于 2019-12-23 09:24:37
问题 I am using the NIO libraries but I am getting a strange error when I try to move files from one directory to another. String yearNow = new SimpleDateFormat("yyyy").format( Calendar.getInstance().getTime()); try { DirectoryStream<Path> curYearStream = Files.newDirectoryStream(sourceDir, "{" + yearNow + "*}"); //Glob for current year Path newDir = Paths.get(sourceDir + "//" + yearNow); if (!Files.exists(newDir) || !Files.isDirectory(newDir)) { Files.createDirectory(newDir); //create 2014

IntelliJ IDEA Working directory设置

痞子三分冷 提交于 2019-12-23 08:54:00
当idea中已有一个Project的情况下,再添加一个新Module的时候,Module的working directory可能默认还是Project的目录。 这样导致的问题是Run Module的Spring boot项目时,其使用的application.properties配置文件不是自己resources目录下的,而是Project工程下面的。 解决办法是修改一下Run/Debug Configurations中的Working directory为 $MODULE_WORKING_DIR$ 即可 来源: CSDN 作者: fangls0707 链接: https://blog.csdn.net/f4761/article/details/103630972

How can i list only the folders in zip archive in Python?

故事扮演 提交于 2019-12-23 08:34:51
问题 How can i list only the folders from a zip archive? This will list every folfder and file from the archive: import zipfile file = zipfile.ZipFile("samples/sample.zip", "r") for name in file.namelist(): print name Thanks. 回答1: One way might be to do: >>> [x for x in file.namelist() if x.endswith('/')] <<< ['folder/', 'folder2/'] 回答2: I don't think the previous answers are cross-platform compatible since they're assuming the pathsep is / as noted in some of the comments. Also they ignore

How can i list only the folders in zip archive in Python?

ぐ巨炮叔叔 提交于 2019-12-23 08:34:47
问题 How can i list only the folders from a zip archive? This will list every folfder and file from the archive: import zipfile file = zipfile.ZipFile("samples/sample.zip", "r") for name in file.namelist(): print name Thanks. 回答1: One way might be to do: >>> [x for x in file.namelist() if x.endswith('/')] <<< ['folder/', 'folder2/'] 回答2: I don't think the previous answers are cross-platform compatible since they're assuming the pathsep is / as noted in some of the comments. Also they ignore

Create directory. If exists, delete directory and its content and create new one in Java

限于喜欢 提交于 2019-12-23 07:58:13
问题 I am trying to make a directory in Java. If it exists, I want to delete that directory and its content and make a new one. I am trying to do the following, but the directory is not deleted. New files are appended to the directory. File file = new File("path"); boolean isDirectoryCreated = file.mkdir(); if (isDirectoryCreated) { System.out.println("successfully made"); } else { file.delete(); file.mkdir(); System.out.println("deleted and made"); } I am creating this directory in runtime in the