directory

C# 对文件(包含目录)的操作

。_饼干妹妹 提交于 2020-01-09 02:48:42
C# 文件操作 向文件中追加文本 File.AppendText FileInfo.AppendText 重命名或移动文件 File.Move FileInfo.MoveTo 删除文件 File.Delete FileInfo.Delete 复制文件 File.Copy FileInfo.CopyTo 获取文件大小 FileInfo.Length 获取文件属性 File.GetAttributes 设置文件属性 File.SetAttributes 确定文件是否存在 File.Exists 读取二进制文件 对刚创建的数据文件进行读取和写入 写入二进制文件 对刚创建的数据文件进行读取和写入 检索文件扩展名 Path.GetExtension 检索文件的完全限定路径 Path.GetFullPath 检索路径中的文件名和扩展名 Path.GetFileName 更改文件扩展名 Path.ChangeExtension System.IO 类 目录操作 string[] drives = Directory.GetLogicalDrives(); //本地驱动器的名,如:C:\等 string path = Directory.GetCurrentDirectory(); //获取应用程序的当前工作目录 Path.GetFileName(@"c:\dir\file.txt"); /

Getting the absolute path of the executable, using C#?

早过忘川 提交于 2020-01-08 11:49:08
问题 Have a look at this pseudocode: string exe_path = system.get_exe_path() print "This executable is located in " + exe_path If I build the above program and place the executable in C:/meow/ , It would print out This executable is located in C:/meow/ each time it is run, regardless of the current working directory. How could I easily accomplish this using C# ? 回答1: MSDN has an article that says to use System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase ; if you need the

How to import a Python class that is in a directory above?

不羁的心 提交于 2020-01-08 11:16:48
问题 I want to inherit from a class in a file that lies in a directory above the current one. Is it possible to relatively import that file? 回答1: Inside a package hierarchy, use two dots, as the import statement doc says: When specifying what module to import you do not have to specify the absolute name of the module. When a module or package is contained within another package it is possible to make a relative import within the same top package without having to mention the package name. By using

DataTable转xml存储到日志

[亡魂溺海] 提交于 2020-01-07 16:38:38
public static void DataTableToXml(DataTable mydt, string Filename) { string directory = System.Web.Hosting.HostingEnvironment.MapPath(@"~/") + "\\log\\"+ DateTime.Now.ToString("yyyyMMdd")+"\\"; System.IO.Directory.CreateDirectory(directory); System.IO.FileStream streamWrite = new System.IO.FileStream (directory+ Filename, FileMode.OpenOrCreate); mydt.WriteXml(streamWrite, XmlWriteMode.WriteSchema); } DataTableToXml(dataTable,“log1.log"); 来源: https://www.cnblogs.com/zhaogaojian/p/12151762.html

Setting up permissions to allow ASP.net code behind to create folders on Server

混江龙づ霸主 提交于 2020-01-07 06:32:44
问题 I have an ASP.net website that will allow users to upload images using a third party webHTMLEditor. I have the overall folder created and the editor finds it but when I try to dynamically create a user specific folder it throws "WinIOError. Access to the path '../common/upload/1' is denied." I'm not very familiar with setting up permissions and IIS on the server side so I was hoping someone could run me through how to give ASP.net code behind the ability to create the numbered folder portion

Iteratively (or recursively?) filter directory and copy results to new directory

两盒软妹~` 提交于 2020-01-07 05:43:06
问题 I’m new to Python and have been teaching myself with textbooks and StackOverflow. I seem to learn best from real world examples from this site. I’m hoping someone can help me with my current problem. I have a directory (folder) with about 1,000 files. The files have names with prefixes (patterns) such as, aaa_* , bbb_* , ccc_* and so on. I would like to iterate through the directory and copy all the files that have the specified prefix and move them to a new directory with that prefix name.

线程池命名

倾然丶 夕夏残阳落幕 提交于 2020-01-07 04:01:14
public BroadcastClusterInvoker(Directory<T> directory) { super(directory); int poolSize = directory.getUrl().getParameter("broadCastPoolSize", 8); paramCallPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(poolSize, new NamedThreadFactory("PARA-CALL-POOL", true));} 来源: https://www.cnblogs.com/cococc/p/12148816.html

Save webpage to server folder

天涯浪子 提交于 2020-01-07 03:15:07
问题 Is there any way to save a external web page to folder on server but with all webpage elements (JS files,images,css... etc.). Like you can do at browser with option save-complete-page but I need this to save with php on my server folder. And when include this folder to show the page as original. Maybe with curl or some php function ... ??? HOW TO DO THAT. please HELP! p.s.I doing this for good reason not for stealing content! and when I finising with operation and function I will empty the

Save webpage to server folder

末鹿安然 提交于 2020-01-07 03:14:12
问题 Is there any way to save a external web page to folder on server but with all webpage elements (JS files,images,css... etc.). Like you can do at browser with option save-complete-page but I need this to save with php on my server folder. And when include this folder to show the page as original. Maybe with curl or some php function ... ??? HOW TO DO THAT. please HELP! p.s.I doing this for good reason not for stealing content! and when I finising with operation and function I will empty the

iOS: Is it ok to store a RSA private key (use to decrypt text) in your application document directory?

末鹿安然 提交于 2020-01-06 19:54:11
问题 I want the user to use their RSA private key via file sharing to store in my App's document directory. It is ok if the user has access to the RSA private key, but I don't want anyone else to have access to it. Is this a good idea and if not how can I get the user's to store his/her RSA private key in my App securely. 回答1: You need to use the keychain to store sensitive information like private keys. https://developer.apple.com/library/ios/documentation/Security/Conceptual/cryptoservices