April 13, 2018 at 2:06 pm
Hello,
i have a small issue, i am trying to move files from source to destination, and there are 20-40 files, which can fluctuate depending on day of the week. the big problem i am having is, i cant seem to get it to work because the files have no extension, so i tried to use *.* in the foreach under Files option... however that never works, any ideas or solution?
thanks in advance
April 13, 2018 at 2:08 pm
sorry also, i am using SSIS 2015, and using foreach for all files (depending the quantity), and within foreach i am using file system task... any help please
April 13, 2018 at 2:16 pm
Can't you just use * ?
April 13, 2018 at 2:25 pm
Thank you ZZartin for the response, i tried to use *
however i get:
Error: 0xC002F304 at File System Task, File System Task: An error occurred with the following error message: "Could not find file '\\sharedrive\FilesToMove\'.".
Task failed: File System Task
Warning: 0x80019002 at Foreach File, Move it!: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
I tried to use Fully Qualified, or Name, and name and extension plus checked the checkbox "Traverse Subfolders" and tried without check, still same error message
April 13, 2018 at 2:40 pm
use a script task instead of a file system task;
the code would look something like this:
string WorkingDirectory = (string)Dts.Variables["WorkingDirectory"].Value;
string ArchiveDirectory = (string)Dts.Variables["ArchiveDirectory"].Value;
if (System.IO.Directory.Exists(WorkingDirectory))
{
foreach (string filename in System.IO.Directory.GetFiles(WorkingDirectory))
{
string JustTheFileName = System.IO.Path.GetFileName(filename);
if (string.IsNullOrEmpty(System.IO.Path.GetExtension(filename)))
{
System.IO.File.Move(filename, System.IO.Path.Combine(ArchiveDirectory, JustTheFileName);
}
}
}
Lowell
April 13, 2018 at 3:03 pm
big thanks Lowell, i will roll with that solution
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy