Solved

VS C# file and directory question

Posted on 2012-04-01
2
254 Views
Last Modified: 2012-04-01
I have created a VS 2008 C# program that creates a series of CSV files and then emails them. The CSV files are written to a folder and each month they get overwritten. Now they want me to archive these files each month and make the output files read-only.

So I have several questions:
1) What function do I use to create a new folder?
2) What function do I use to move these files to this new folder?
3) What function do I use to delete these files from the original folder?
4) What function do I use to change the file attribute to read-only?
0
Comment
Question by:rwheeler23
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 37793056
1) System.IO.Directory.CreateDirectory
2) System.IO.File.Move
3) System.IO.File.Delete (but Move should "erase" the original once it has been moved to the destination directory)
4) System.IO.File.SetAttributes, using the FileAttributes.ReadOnly flag.
0
 

Author Closing Comment

by:rwheeler23
ID: 37793792
Thank you.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where did System.Data.Objects go? 2 40
C# Desktop Application 3 54
Example works but why do I need to click twice on button 4 48
Adding items to a C# list incrementally 5 28
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question