Solved

VS C# file and directory question

Posted on 2012-04-01
2
262 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 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