System.IO.File.Copy hangs

Posted on 2011-04-19
Medium Priority
Last Modified: 2013-11-30
Hi Experts,

I need to copy a file from one location to a directory local to the SQL Server.

The reason for this is, I am doing a Bulk Insert Task, and it doesn't seem to work when I am accessing the file from a UNC path of a remote location (i.e. \\servername\directory\filename.csv) That is correct, right?

Anyway, I have a script task to copy the file, which is simply:

This step hangs and the task is always yellow (never completes).

I believe this is do to the UNC network path again.. but not sure.

The copy is always successful, it just hangs after that.

How do I tell System.IO.File.Copy to finish?

Question by:rss2
  • 2
  • 2
LVL 21

Expert Comment

by:Alpesh Patel
ID: 35424091
Please use File System task to move or copy file.

Author Comment

ID: 35424608
The File System task also hangs.

LVL 21

Accepted Solution

Alpesh Patel earned 2000 total points
ID: 35430638
It may takes long due to file is big in size.. or windows issue

Author Closing Comment

ID: 35878266
Spot on

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

750 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