.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Move files conditionally

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :

The overall process I'm trying to create in SSIS/BIDS 2008 is to create (file system) folders based on values in the database and then to move a number of files, from a central location, into those sub-folders. For example, I have letters A.doc, B.doc and C.doc. In the SQL database, these files are referenced against a person number. E.g.

ID  FileName  PersonNo

1   A.doc        6231

2   B.doc        7654

3   C.doc        9876


The first part, I managed to do via an Execut SQL Task, which gets the Person Numbers and passes that into a Foreach Loop Container, which has a File System Task that creates the folder names. I combined the below approaches to make it work:



Works well, and the only change I had to make was to cast the number as char to get it into the string variable. So far so good, and it creates, in this example, the below folders:




Now I'm at the process where I need to move the files into the right folder

View Complete Post

More Related Resource Links

Restore using TSQL, how to determine the files to move/overwrite


There might be an easier way to perform it, if so, please advise.  I am looking for a scriptable solution (preferably TSQL).

I want to code a tsql procedure to restore a database from a backup file (.bak).  The procedure must allow to restore a backup from a database to a different database.

When performing it through the SSMS interface, I see all the files in the .bak file.  From there, I can associate the files in the backup to the appropriate files in my destination database.  when generating TSQL, this translates to MOVE statements for the files.

Can I translate the whole process in TSQL?  In order to know how to map my files, I must first gather the information on which files are present in my bak file.  Can one read the definition of the files contained in a backup file before performing the restore.  Preferably using TSQL?

Move the database files to different branches before replication?


Hi all,


I want to start a replication between 3 sites using Merge replication, 1<sup>st</sup> branch is the distributer and publisher and already has a database, the others are subscribers and they are new (No data yet). But the size of the database in the main branch is about 4 GB. So if I start the replication, 4 GB will be replicated which something I don’t want. Is there a way I can put the database in the other branches manually? So nothing will need to replicate at the first time. And then replication will take place.


Waiting your valuable reply,




Errors when I try to move the Index files


I tried to change the location of the search index files in Central Admin.  The current setting is the default:  C:\Program Files\Microsoft Office Servers\14.0\Data\Office Server\Applications

I want to just put it on E:\Program Files\Microsoft Office Servers\14.0\Data\Office Server\Applications - so all I changed was the drive letter.

It churned for awhile then listed this error:

Errors were encountered during the configuration of the Search Service Application.

Microsoft.Office.Server.Search.Administration.SearchConfigWizard+SearchConfigWizardException: Topology provisioning failed due to an error.Topology activation was aborted because of Microsoft.Office.Server.Search.Administration.QueryComponentTransitionException: The index location E:\Program Files\Microsoft Office Servers\14.0\Data\Office Server\Applications is invalid because I/O error occurred.. ---> System.IO.IOException: I/O error occurred. at Microsoft.SharePoint.Administration.SPServer.CreateDirectory(String path, SPAclUserGroupAccessLevel userGroupAccessLevel) at Microsoft.SharePoint.Administration.SPServer.CreateSecureDirectory(String path) at Microsoft.Office.Server.Search.Administration.QueryComponent.Create

Move SharePoint Document Library Files to Local Drive

How can I move files uploaded into a MOSS 2007 Document library to a local drive? I need to automate this as a job, not a one-time process. Can I use SSIS for it? File Systems Task works fine so long as I create a map drive to the portal. I have tried both the http address and the UNC path to the portal.

Move/Copy files between SQL servers.


Hi folks,

I would like to move/copy some files between two SQL servers.  The files are consist of .css .png .jpg and .gif files.  I've tried to do this using the File System Task but I can't for the life of me work out how I point it to the servers file system.  I'm obviously not an SSIS guru, I had a play and can move files around my own PC from location to location, but can work out my server to server issue, I hope someone can help, or at least point me in the right direction.

I'm going from SQL2005 to SQL2008 if that makes any difference, but as I say its not SQL tables, data, or what not, it's simply moving files that happen to be stored on the two servers.

Thanks in advance


How to move the SQL Server SQLFT log files created by the full text catalog process.


I need to move the location of the SQLFT text log files from it's current location %ProgramFiles%\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\LOG folder to another larger drive to accomodate the log file growth.  I cannot find anything on how to make this change.  Does anyone have an answer?  I have found this is a default at install - but during install did not find how to change this. 

Thank you.



Which task would use to copy, move or delete files in SSIS

can any one help me for this question any link of examples for the same highly appreciable
Regards, Amitesh Srivastva

Clean Web.Config Files (VS 2010 and .NET 4.0 Series)

.NET 4 includes a new version of the CLR, and a new .NET 4 specific machine.config file (which is installed side-by-side with the one used by .NET 2, .NET 3 and .NET 3.5).

The new .NET 4 machine.config file now automatically registers all of the ASP.NET tag sections, handlers and modules that we've added over the years, including the functionality for:

.ASP.NET Dynamic Data
.ASP.NET Routing (which can now be used for both ASP.NET WebForms and ASP.NET MVC)
.ASP.NET Chart Control (which now ships built-into ASP.NET V4)
What this means is that when you create a new "Empty ASP.NET application" project in VS 2010, you'll find that the new default application-level web.config file is now clean and simple:

SharePoint document migration challenges when migrating files and folders

There are several challenges when migrating documents to Microsoft SharePoint. While these challenges can be overcome, they are a real pain if the migration source, content and file systems are not SharePoint friendly.

Combine, minify and compress JavaScript files to load ASP.NET pages faster

Websites are getting more interactive these days and most of this interactivity comes from JavaScript. People are using different JavaScript libraries and frameworks to make their websites more interactive and user friendly.

PrintPocketCE Print Pocket Excel, Pocket Word and email files

Version 3.560 (May 15, 2009):

Important bug fix: a slight difference in how some devices create fonts was causing a few devices to have significantly longer print times for large print jobs.

Adjusted PocketJet printer paper feed commands

Other minor fixes and enhancements.

Version 3.559 (Mar 5, 2009):

Added support for Martel MCP78xx printers

Version 3.558 (Aug 20, 2008):

Added support for Martel MCP78xx printers

Version 3.557 (June 27, 2008):

Fixed error in Canon printer support

Fixed COM0 port selection

Version 3.556 (June 15, 2008):

Added support for Brother MW-260

Added support for Sato MB400

Version 3.555 (Aug 8, 2007):

Added support for Pentax RuggedJet 3 and RuggedJet 4 printers

Changed Epson TM-P60 support to maximum page width of 1200 dots

Version 3.551 (Aug 1, 2006):

Added Peripheral Nomad printer support

Version 3.550 (Mar 23, 2006):

Added Panasonic JT-H200PR printer support

Added Pocket Spectrum printer support

Fixed problem with WM5.0 "inverted image" problem

Conversion of text files from ANSI to UTF-8

reading and writing text files in ANSI format and
writing html-files in Charset ISO-8859-1 (Western Europe).

How to transfer files between computer and mobile device using bluetooth

What is Bluetooth? How can I have it on my computer?

Bluetooth wireless technology is a communication technology that allows two devices to communicate wirelessly. Most of the notebooks are nowadays equipped with bluetooth. For those notebooks or computers that don't, you can use a bluetooth dongle to add the functionality and it just costs you around $5. Although higher price range bluetooth dongles are available but it makes no sense of buying them if you just plan to connect your mobile device to the computer. Look for one that has Bluetooth v2.0 + EDR (Enhance Data Rate) supporting speeds of upto 3Mbps and with Vista support. You can easily have one of that kind in just $5.

Setting up bluetooth to work on your computer

Just Insert the bluetooth dongle in the USB.
It should get detected by your Operating System and should be ready to use. In case it is just detected as a new hardware, you need to install drivers for it that came with your bluetooth dongle (You can try Google to find the drivers).
Once drivers are installed, a bluetooth notification icon will appear in your system tray.
Right Click on it to access Settings (This may vary with your bluetooth dongle).
Make sure you have turned Discovery On (It allow others to see your computer).
Switch On the bluetooth on the mobile device.

dynamically adding sql server columns based on number of files in fileuploader


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.


I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!


Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


Printing resource files



I have some resource files for localization and would like to print them. When I try to print them in Visual Studio (with File -> Print...) the button is disabled. Does anyone know how to print them? (Without copying each into word or excel)

Thanks and regards,

Wrong Account being used to access files - Help - No Impersonation


I run a simple .aspx website on a Windows Server 2008 machine.

There is NO impersonation, and System.Security.Principal.WindowsIdentity.GetCurrent().Name returns NT AUTHORITY\NETWORK SERVICE, which it the account which the application pool runs. In my web.config, I have <authentication mode="Forms">.


I tried to test the security of the application and server by removing file permissions to the .aspx files. I was greatly worried when the website continued to run without problem (it should not have been able to read the .aspx files).

By turning on file level auditing, I discovered that the .aspx files were being read by the machine$ account (if the machine is called Serv1, then the files would be read by the Serv1$ account, which seems to have access to all files on the local machine).


Is this a security breach or is this behaviour by design ?

Please can somebody assist, as I am worried.

Disallow Direct Access To Files



Here is my dilema, on my site i have a WordPress Audio player (http://wpaudioplayer.com/standalone) that plays my mp3's.

It loads the Mp3's in by javascript...example below:

       AudioPlayer.embed("audioplayer_7", { soundFile: "/Files/Music/[name of file].mp3" });

This file name is clearly visible in the browser source. Not a problem, however this means that any user can legitimately browse to the file directly and download it.

Now i still need the mp3 player (which is flash) to have access to the file but if a user was to try accessing the file directly, they would not be allowed access to it.

I am not sure how to go about this, i am circling the idea of a httphandler but not sure if this is sufficiant to stop the direct access to the file.

Any help would be appreciated

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend