VS 2005 SSIS File System Task Move all files from Source Directory to Destination Directory

StackOverflow https://stackoverflow.com/questions/23227365

  •  07-07-2023
  •  | 
  •  

Domanda

I have a source directory that could have a number of files with varying names in it. I want to move all the contents to an archive directory. How can I do this with a File System Task?

I tried to put a wild card on my source file name *.* using expressions but this has not worked. I'm trying to avoid using a script command to accomplish this task.

È stato utile?

Soluzione

Although my answer works for 2008, it might be helpful for 2005 version. You can do this several ways. One is to use a File System Task and copy all the files in the directory to the destination folder, the other is to use a Foreach Loop and move files one by one for each file you choose with the File settings. With *.* all files will pass.

There are a lot of videos online, like: move & rename or just copy Or check out this link to give you an idea.

First method will copy all files from source folder to destination. This also keeps the files in the source. (TEST is the sourcefolder and TESTB is the destination folder.)

enter image description here

The second method (see below) is much more flexible: a) create a Foreach loop b) put File System Task in loop. Create a String type variable and choose it in the SourceConnection. Just put something in de default value of the variable, so the code will have something to start with.

enter image description here enter image description here

enter image description here

Perhaps there are more methods, but these worked for me. Hope this helps!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top