Questions tagged [file-attributes]

Question regarding create/read/update file attributes in code

169 questions
84
votes
8 answers

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

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 the following, it removes all the…
MilMike
  • 11,759
  • 12
  • 58
  • 78
35
votes
3 answers

Best way to make a file writeable in c#

I'm trying to set flag that causes the Read Only check box to appear when you right click \ Properties on a file. Thanks!
will
  • 3,741
  • 5
  • 31
  • 47
33
votes
2 answers

How to set "execute" attribute to a file and check it in SVN from Windows?

I have SVN configured in Linux at a different location and I need to check-in a shell script to SVN with executable attribute ON from Windows. I use Bamboo as CI, which checks out sources from SVN and does the periodic build. It throws error that…
Mark
  • 335
  • 1
  • 3
  • 5
30
votes
8 answers

How to access a file's properties on Windows?

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.
Davey
27
votes
3 answers

C# make file read/write from readonly

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…
Thomas Clayson
  • 28,448
  • 25
  • 135
  • 216
24
votes
5 answers

How to set clear attribute "X" on files with in C#?

I have a hidden file on my USB removable storage (FAT file system). I'm using Windows 7. If I go to Properties window of this file and then to the Details tab, I will see that the attributes of the file are HX. When I run cmd and use attrib, I was…
beam022
  • 1,623
  • 4
  • 19
  • 26
23
votes
5 answers

Using VBA to get extended file attributes

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…
Jim McKeeth
  • 37,154
  • 23
  • 116
  • 187
22
votes
1 answer

Keeping file attributes on a copy

I have the situation whereby I want to keep the original attributes on a file (the file creation date etc). Normally when you copy files in Windows, the copy that you make gets new 'modified' dates etc. I have come accross the shutil.copy command —…
Insert Text Here
  • 241
  • 1
  • 2
  • 5
16
votes
3 answers

What does the dot at the end of the permissions in the output of "ls -lah" mean?

I found some Linux files, and when I type ls -lah, it outputs this permissions format: ... drwxr-xr-x. 2 root root ... -rw-rw-r--. 1 root root ... I would like to know, what is the meaning of the dot (-rw-rw-r--.) at the end of the…
miller
  • 1,352
  • 3
  • 21
  • 49
10
votes
3 answers

Git on Windows and file attributes

I noticed that when you commit or checkout files using Git in a Windows environment, the file attributes are not preserved (for example hidden or read-only). If I commit a hidden file and then I check it out on another computer, the file is no more…
StockBreak
  • 2,528
  • 1
  • 26
  • 48
10
votes
3 answers

Get File Creation Date Over HTTP

Given a file on a webserver (e.g., http://foo.com/bar.zip -> only accessible through HTTP), is there any way to get the date attributes (e.g., date [created, modified]) without downloading the entire archive in the first place? Right now, I download…
9
votes
2 answers

Testing for file attribute in batch file

I'm writing a batch file and I need to know if a file is read only. How can I do that ? I know how to get them using the %~a modifier but I don't know what to do with this output. It gives something like -ra------. How can I parse this in batch file…
Eric Fortin
  • 7,323
  • 2
  • 23
  • 31
9
votes
2 answers

Getting specific file attributes

I've got a simple WCF service that lets clients/consumers upload image, audio or video files to it. After the upload, the service is supposed to analyze the file and somehow retrieve the following attributes: Image: width, height, date taken,…
rafale
  • 1,594
  • 6
  • 26
  • 42
9
votes
2 answers

stat function for perl6

Is there an alternate way in perl6 to get file attribute details like size, access_time, modified_time.. etc. without having to invoke native call? As per the doc it is "unlikely to be implemented as a built in as its POSIX specific". What…
User9102d82
  • 1,114
  • 6
  • 17
7
votes
2 answers

Make folder hidden after Inno Setup installs it

My application has a folder of files that are all marked as "hidden" (including the folder itself). However, Inno Setup won't copy them for installation unless I remove the "hidden" attribute first. Fair enough, but is there a way to make Inno Setup…
User2571
  • 95
  • 2
  • 4
1
2 3
11 12