file-attributes

C# make file read/write from readonly

微笑、不失礼 提交于 2019-11-27 17:19:15
问题 If File.SetAttributes("C:\\myFile.txt", FileAttributes.ReadOnly); sets a file as read only, how do I set it back to read/write if I need to? I suspect it would be FileAttributes.Normal however will this change any other properties of the file? There isn't an awfully descriptive note on the MSDN site... The file is normal and has no other attributes set. This attribute is valid only if used alone. Thanks 回答1: To remove just the ReadOnly attribute, you'd do something like this: File

Python windows File Version attribute

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 11:03:23
Last time I asked a similar question but that was about svn related versioning info. Now I am wondering how to query windows "File version" attribute about eg. a dll. I payed attention to wmi and win32file modules as well without success. Here is a function which reads all file attributes as a dictionary: import win32api #============================================================================== def getFileProperties(fname): #============================================================================== """ Read all properties of the given file return them as a dictionary. """ propNames =

How to remove a single Attribute (e.g. ReadOnly) from a File?

余生颓废 提交于 2019-11-27 01:15:15
Let say, a file has the following attributes: ReadOnly, Hidden, Archived, System . How can I remove only one Attribute? (for example ReadOnly) If I use: Io.File.SetAttributes("File.txt",IO.FileAttributes.Normal) it removes all the attributes. From MSDN : You can remove any attribute like this (but @sll's answer for just ReadOnly is better for just that attribute) using System; using System.IO; using System.Text; class Test { public static void Main() { string path = @"c:\temp\MyTest.txt"; // Create the file if it exists. if (!File.Exists(path)) { File.Create(path); } FileAttributes attributes

How to remove a single Attribute (e.g. ReadOnly) from a File?

孤街浪徒 提交于 2019-11-26 12:26:27
问题 Let say, a file has the following attributes: ReadOnly, Hidden, Archived, System . How can I remove only one Attribute? (for example ReadOnly) If I use: Io.File.SetAttributes(\"File.txt\",IO.FileAttributes.Normal) it removes all the attributes. 回答1: From MSDN: You can remove any attribute like this (but @sll's answer for just ReadOnly is better for just that attribute) using System; using System.IO; using System.Text; class Test { public static void Main() { string path = @"c:\temp\MyTest.txt

Python windows File Version attribute

旧街凉风 提交于 2019-11-26 10:25:33
问题 Last time I asked a similar question but that was about svn related versioning info. Now I am wondering how to query windows \"File version\" attribute about eg. a dll. I payed attention to wmi and win32file modules as well without success. 回答1: Here is a function which reads all file attributes as a dictionary: import win32api #============================================================================== def getFileProperties(fname): #========================================================

Using VBA to get extended file attributes

妖精的绣舞 提交于 2019-11-26 04:50:45
问题 Trying to use Excel VBA to capture all the file attributes from files on disk , including extended attributes. Was able to get it to loop through the files and capture the basic attributes (that come from the file system): File Path File Name File Size Date Created Date Last Accessed Date Last Modified File Type Would also like to capture the extended properties that come from the file itself: Author Keywords Comments Last Author Category Subject And other properties which are visible when