Solved

VS C# file and directory question

Posted on 2012-04-01
2
239 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now