TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vasu Gadhiya
NA
429
103.3k
can't copy all files from one directory to other directory.
Sep 10 2013 12:39 AM
I Write Code For create a new folder and copy all photo from other folder to new folder.
-----------------------------------------------
string path = Server.MapPath(@"photos\test2");
string sourcepath = Server.MapPath(@"photos\test");
System.IO.Directory.CreateDirectory(path);
string[] files = System.IO.Directory.GetFiles(sourcepath);
foreach (string s in files)
{
string filename = System.IO.Path.GetFileName(s);
string destfile = System.IO.Path.Combine(sourcepath, filename);
System.IO.File.Copy(s, destfile, true);
}
-----------------------------------------------
But when its run its occur error
Server Error in '/' Application.
The process cannot access the file
'I:\vasu\Project\test\error.png' because it is being used by another process.
Line 48: System.IO.File.Copy(s, destfile, true);
Reply
Answers (
2
)
No cache
I have done webservice. need in asp.net web aspi json format