directory

Checking if a directory exists in Unix (system call)

只愿长相守 提交于 2019-12-17 03:18:25
问题 I am not able to find a solution to my problem online. I would like to call a function in Unix, pass in the path of a directory, and know if it exists. opendir() returns an error if a directory does not exist, but my goal is not to actually open, check the error, close it if no error, but rather just check if a file is a directory or not. Is there any convenient way to do that please? 回答1: There are two relevant functions on POSIX systems: stat() and lstat(). These are used to find out

Creating a directory in /sdcard fails

穿精又带淫゛_ 提交于 2019-12-17 03:01:12
问题 I have been trying to create a directory in /sdcard programmatically, but it's not working. The code below always outputs directory not created. boolean success = (new File("/sdcard/map")).mkdir(); if (!success) { Log.i("directory not created", "directory not created"); } else { Log.i("directory created", "directory created"); } 回答1: There are three things to consider here: Don't assume that the sd card is mounted at /sdcard (May be true in the default case, but better not to hard code.). You

Checking for directory and file write permissions in .NET

点点圈 提交于 2019-12-16 20:33:59
问题 In my .NET 2.0 application, I need to check if sufficient permissions exist to create and write to files to a directory. To this end, I have the following function that attempts to create a file and write a single byte to it, deleting itself afterwards to test that permissions do exist. I figured the best way to check was to actually try and do it, catching any exceptions that occur. I'm not particularly happy about the general Exception catch though, so is there a better or perhaps a more

Find current directory and file's directory [duplicate]

我的未来我决定 提交于 2019-12-16 19:40:10
问题 This question already has answers here : How to properly determine current script directory? (11 answers) How to know/change current directory in Python shell? (7 answers) Closed 2 years ago . In Python, what commands can I use to find: the current directory (where I was in the terminal when I ran the Python script), and where the file I am executing is? 回答1: To get the full path to the directory a Python file is contained in, write this in that file: import os dir_path = os.path.dirname(os

dubbo控制台安装

烂漫一生 提交于 2019-12-14 11:08:56
1、下载地址 https://github.com/dangdangdotcom/dubbox 2、打包 在项目根目录pom 同级目录下,Cmd 当前路径 mvn package -Dmaven.test.skip=true 3、安装tomcat 解压后,在bin下 ./catalina. sh start https://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.tar.gz 4、控制台安装 在上面打包的admin包,放入linux下tomcat的webapps目录下 dubbo-admin-2.8.4.war 启动tomcat 会自动解压war 进入解压的dubbo-admin-2.8.4里 修改配置 /data/apache-tomcat-7.0.96/webapps/dubbo-admin-2.8.4/WEB-INF dubbo.properties 内容 dubbo.registry.address=zookeeper://192.168.204.81:2181?backup=192.168.204.82:2181,192.168.204.83:2181 dubbo.admin.root.password=root dubbo.admin.guest.password

How to compress each subfolder in a folder into a separate RAR archive using WinRAR?

橙三吉。 提交于 2019-12-14 03:57:34
问题 I am really new to batch file coding and need your help. I've these directories: c:\rar\temp1\xy.jpg c:\rar\temp1\sd.jpg c:\rar\temp1\dd.jpg c:\rar\temp2\ss.jpg c:\rar\temp2\aa.jpg c:\rar\temp2\sd.jpg c:\rar\temp3\pp.jpg c:\rar\temp3\ll.jpg c:\rar\temp3\kk.jpg And I want to compress them to this c:\rar\temp1\temp1.rar c:\rar\temp2\temp2.rar c:\rar\temp3\temp3.rar How could this be done using WinRAR? 回答1: This can be done also with WinRAR without using a batch file, not exactly as requested,

Copy and Rename newest file

北城余情 提交于 2019-12-14 03:32:20
问题 I want to copy latest file from source path to target Path and then rename as below: Target Path : C;\User\Client1\FinalReports Source Path: C:\User\Client1\Reports\ReportFolderA (file from Report FolderA should be renamed to target Folder as File1.csv) C:\User\Client1\Reports\ReportFolderB (file from Report FolderB should be renamed to target Folder as File2.csv) C:\User\Client1\Reports\ReportFolderD (file from Report FolderD should be renamed to target Folder as File4.csv) C:\User\Client1

WIN32_FIND_DATA FileNAme doesn't put out the filenames but instead put's out HEx-Codes [duplicate]

限于喜欢 提交于 2019-12-14 03:25:19
问题 This question already has answers here : How I can print the wchar_t values to console? (7 answers) cout a string gets the address instead of value [duplicate] (1 answer) Closed last year . I tried to get a full list of all the files in a folder like this: #include<Windows.h> #include<iostream> #include<stdio.h> using namespace std; void main() { HANDLE dateiHandle; WIN32_FIND_DATA wfindD; dateiHandle = FindFirstFile(L"E:\\Roman\\PIC\\funpics\\*", &wfindD); do { cout << wfindD.cFileName <<

create folders based on a file name and move those files into that folder

眉间皱痕 提交于 2019-12-14 03:22:05
问题 I am a novice in creating automated tasks. I need to create folders based on a file name and move those files into that folder. There are instructions, but I am a little scared to try...little help? 回答1: Split this into two steps (assume using C++ in Windows OS): Create a folder. #include <Windows.h> void create_folder(char* Path) { char DirName[256]; char* p = Path; char* q = DirName; while(*p) { if (('\\' == *p) || ('/' == *p)) { if (':' != *(p-1)) { CreateDirectory(DirName, NULL); } } *q++

Creating folder in file-explorer using DDMS perspective

落爺英雄遲暮 提交于 2019-12-14 03:16:02
问题 I am trying to create a new folder for sd-card using DDMS perspective. Few days ago I created a sub-folder named DCIM in folder called sdcard : Snapshot-1: Problem I am facing: Today I can't access that folder If I try to create the folder again I get an error as below but as stated I can't see the folder also created few days ago How to resolve this ? 回答1: By default sdcard folder contains a folder named DCIM . Thats why you are getting that message. Try creating a folder with some other