Solved

windows service to move file after read

Posted on 2014-02-19
3
473 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
3 Comments
 
LVL 15

Assisted Solution

by:Minh Võ Công
Minh Võ Công earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
good
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still 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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

12 Experts available now in Live!

Get 1:1 Help Now