Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Reply
copy multiple file
prabhat khadka
Nov 30 2007 7:21 AM
2.8k
Reply
I have written a code that copies one file of a folder using byte[].Code is below:
private static void sendFile()
{
string folderpath = @"c:\screenshot\ram.jpeg";
try
{
// DirectoryInfo di = new DirectoryInfo(folderpath);
// FileInfo[] fi = di.GetFiles();
// foreach(FileInfo Finfo in fi)
{
FileStream fs;
fs = new FileStream(folderpath,FileMode.Open);
byte[] byteFile = new byte[fs.Length];
fs.Read(byteFile,0,byteFile.Length);
fs.Close();
getbyte(byteFile, "ram");
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}
private static void getbyte(byte[] mybte,string filename)
{
byte [] byteFile= mybte;
// LogManager.managelog("file name requested is" +line);
FileStream fs;
string saveTo=@"C:\copyPath";
fs = new FileStream(saveTo + @"\" + filename,FileMode.Create);
fs.Write(mybte, 0, byteFile.Length);
fs.Close();
}
}
How to copy the whole .jpeg files from the screenshot folder to copypath folder??
Thanx in advance.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
How to create a login form
Login to Windows Programmatically