i want to create a window service that does following
on every 30 sec it checks a folder and if it finds any file in it then it moves all those file to another folder.
how can i do that
can you provide the solution or any link where i can refer to
Loading
Laxmidhar SahooPosted Jan 5, 2020, 11:01 PM
Amit MohantyPosted Jan 5, 2020, 10:38 PM
Then you can access it using following syntax
Jignesh KumarPosted Jan 5, 2020, 9:25 AM
Laxmidhar SahooPosted Jan 5, 2020, 12:28 AM
Thirumoorthy LakshmananPosted Jan 4, 2020, 10:25 AM
Logesh PalaniPosted Jan 4, 2020, 6:12 AM
Amit GuptaPosted Jul 9, 2019, 12:21 PM
pradip PatilPosted Jul 9, 2019, 9:16 AM
you told your code is working, can you please share your code, Here I have the same task to do.
bhanuprakash inturiPosted Aug 28, 2013, 3:35 AM
you told your code is working, can you please share your code, Here I have the same task to do.
Thanks
Bhanu Prakash
nishant ranjanPosted Apr 4, 2013, 6:43 AM
its moving from one folder to other
but i want it to move within LAN i.e., from one system to other system folder
how can i do this
nishant ranjanPosted Apr 3, 2013, 5:05 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
using System.Timers;
namespace movingfile
{
public partial class Service1 : ServiceBase
{
public Timer t1 = null;
public Service1()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
t1 = new Timer();
this.t1.Enabled = true;
this.t1.Elapsed += new ElapsedEventHandler(t1_Tick);
this.t1.Interval = 10000;
}
protected override void OnStop()
{
this.t1.Enabled = false;
}
public void t1_Tick(object sender, EventArgs e)
{
File.Copy("c:\\input\\*.*", "D:\\copy\\*.*");
File.Move("c:\\input\\*.*", "D:\\output\\*.*");
}
}
}
Prasant JinagaPosted Apr 2, 2013, 5:19 AM
You can use FileSystemwatcher class, else the attached code will work..
Please find the attached code which will keep invoking the directory every 2 sec if there are any files it will move to other directory.
Hope it helps !!!
Thanks,
Prasant