Solved

What is the Best practice to copy files to local folder from a remote website

Posted on 2013-01-16
2
185 Views
Last Modified: 2013-03-26
I would be glad to know the best practice to copy some image files periodically (every 10 minutes) based on a certain pattern of file names in a particular directory from a remote website's directory.

Options:
1. In an SSIS package or
2. In .NET library or any other ideas??

Thanks in advance!!
0
Comment
Question by:InquisitiveMind
2 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 38785242
why are you running a task out SQL rather than running it as a scheduled task?
your script vb or c# can access the database if needed to identify paths without wasting SQL server resources.
0
 
LVL 15

Accepted Solution

by:
angus_young_acdc earned 500 total points
ID: 38793840
If it is going to be running all the time I wouldn't do a scheduled task, personally I would do the below:

I would create a .Net library which is called by a .Net Windows Service, you can set this to run every 10 minutes via a timer.  For example:

namespace MyFileService
{
    public partial class MyService : ServiceBase
    {
        private Timer _systemTimer;

        public MyService()
        {
            InitializeComponent();
            this.ServiceName = "MyService";
            this.AutoLog = true;
            this.CanPauseAndContinue = false;
            _systemTimer = new Timer(600000); // 10 minutes
            _systemTimer.Elapsed += _systemTimer_Elapsed;
        }

        void _systemTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            try
            {
                _systemTimer.Stop();
		// Start moving or copying the files
		// DirectoryInfo di.....
       			
            }
            catch (Exception ex)
            {
                // handle your error
            }
            finally
            {
                _systemTimer.Start();
            }
        }

        protected override void OnStart(string[] args)
        {
            _systemTimer.Start();
        }

        protected override void OnStop()
        {
            _systemTimer.Stop();
            _systemTimer.Dispose();
        }
    }
}

Open in new window

0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

808 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