Solved

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

Posted on 2013-01-16
2
188 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
[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
2 Comments
 
LVL 78

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to set focus on a dynamic control 18 52
Help with Report Viewer in VS2013 6 33
HIghlights of SSIS? 3 44
.NET universe documentation poster 2 24
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…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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