Answering on your question in title regarding ReadOnly
attribute:
FileInfo fileInfo = new FileInfo(pathToAFile);
fileInfo.IsReadOnly = false;
To get control over any attribute yourself you can use File.SetAttributes()
method. The link also provides an example.
More Related Contents:
- Is there a way to check if a file is in use?
- Easiest way to read from and write to files
- Nested using statements in C#
- How to change the timeout on a .NET WebClient object
- How to find the most recent file in a directory using .NET, and without looping?
- Best way to resolve file path too long exception
- Better way to check if a Path is a File or a Directory?
- C# – Get a list of files excluding those that are hidden
- Mirroring console output to a file
- How to get files in a relative path in C#
- Why does Path.Combine not properly concatenate filenames that start with Path.DirectorySeparatorChar?
- How can I create a temp file with a specific extension with .NET?
- How to insert characters to a file using C#
- How do I get the directory from a file’s full path?
- Check if an executable exists in the Windows path
- Read random line from a file? c#
- Getting files by creation date in .NET
- Delete files older than 3 months old in a directory using .NET
- Encrypt SQLite database in C#
- C# Searching for files and folders except in certain folders
- How does the method overload resolution system decide which method to call when a null value is passed?
- Detailed Explanation of Variable Capture in Closures
- Capture screenshot Including Semitransparent windows in .NET
- C# int to byte[]
- Why won’t control update/refresh mid-process
- Operation could destabilize the runtime?
- datetime to string with time zone
- Pair-wise iteration in C#, or sliding window enumerator
- Compilation Error: “The modifier ‘public’ is not valid for this item” while explicitly implementing the interface
- Example code required for how to access embedded .Net image resources in C#