?
Solved

windows service to move file after read

Posted on 2014-02-19
3
Medium Priority
?
519 Views
Last Modified: 2014-02-25
I am having two folder A,B.

Folder A Kept one XML file,i have to read that xml file and insert the corresponding
data in to database ,after that  Moved that file to Folder B.
it will be done in
every 5 minutes through widows service.

Could you please provide the code for the same.
0
Comment
Question by:nicemanish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Assisted Solution

by:Minh Võ Công
Minh Võ Công earned 750 total points
ID: 39872265
string filename =  "test.txt";
string sourceFolder = @"C:\Users\Public\public\";
 string destinationFolder = @"C:\Users\Public\private\";

        // To move a file or folder to a new location:
        System.IO.File.Move(sourceFolder + filename  , destinationFolder  + filename );

        // To move an entire directory. To programmatically modify or combine
        // path strings, use the System.IO.Path class.
        System.IO.Directory.Move(@"C:\Users\Public\public\test\", @"C:\Users\Public\private");

code sample:
http://msdn.microsoft.com/en-us/library/cc148994.aspx
0
 
LVL 16

Accepted Solution

by:
Kalpesh Chhatrala earned 750 total points
ID: 39872473
Check below Windows Service Step By Step Tutorial

http://www.codeproject.com/Articles/106742/Creating-a-simple-Windows-Service 

you need to use Timer in Windows Service to execute previous author code every 5 minute.
0
 

Author Closing Comment

by:nicemanish
ID: 39885383
good
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

743 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