Solved

windows service to move file after read

Posted on 2014-02-19
3
500 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 250 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 250 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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

728 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