Click here to Skip to main content
15,887,427 members
Home / Discussions / C#
   

C#

 
QuestionHow can I deserialize/Load Different XML files? Pin
SebGM201813-Jun-18 17:38
SebGM201813-Jun-18 17:38 
AnswerRe: How can I deserialize/Load Different XML files? Pin
Richard MacCutchan13-Jun-18 21:48
mveRichard MacCutchan13-Jun-18 21:48 
GeneralRe: How can I deserialize/Load Different XML files? Pin
SebGM201814-Jun-18 10:51
SebGM201814-Jun-18 10:51 
GeneralRe: How can I deserialize/Load Different XML files? Pin
Richard MacCutchan14-Jun-18 21:31
mveRichard MacCutchan14-Jun-18 21:31 
GeneralRe: How can I deserialize/Load Different XML files? Pin
SebGM201814-Jun-18 10:52
SebGM201814-Jun-18 10:52 
QuestionUsing Email Retrieval (EAGetMail) in Unity Pin
Member 1387162013-Jun-18 8:53
Member 1387162013-Jun-18 8:53 
AnswerRe: Using Email Retrieval (EAGetMail) in Unity Pin
Gerry Schmitz13-Jun-18 10:34
mveGerry Schmitz13-Jun-18 10:34 
QuestionMoving File to corresponding folders Pin
SanjaV 13-Jun-18 8:16
SanjaV 13-Jun-18 8:16 
0
down vote
favorite
I need to write a code in script component in SSIS that will move files to corresponding folders. Files that I'm getting are usually named, for example "Dem323_04265.45.23.4", "Dem65_459.452.56", "Ec2345_456.156.7894" and I need to move them to a corresponding folders. The name of my folders are "Oklahoma City (323)", "New York(65)".. I need to move those files to matching folders, so for example "Dem323_04265.45.23.4" would go to folder "Oklahoma City (323)". I need to modify my code so the number that is located between first two or three letter and underline matches number located in parenthesis. I've been working on this for several days already and I'm new with ssis and c#, so any help would be appreciated. This is the code I have so far:

public void Main()
    {
        string filename;
       // string datepart;
        bool FolderExistFlg;
        filename = Dts.Variables["User::FileName"].Value.ToString();
        // datepart = (filename.Substring(filename.Length - 12)).Substring(0, 8);
        var folderNumber = Regex.Match(
            filename,

    //Dts.Variables["OutputMainFolder"].Value.ToString(),
                    @"\(([^)]*)\)").Groups[1].Value;
        FolderExistFlg = Directory.Exists(Dts.Variables["OutputMainFolder"].Value.ToString() + "\\" + folderNumber);

        if (!FolderExistFlg)
        {
            Directory.CreateDirectory(Dts.Variables["OutputMainFolder"].Value.ToString() + "\\" + folderNumber);
        }

        File.Move(Dts.Variables["SourceFolder"].Value.ToString() + "\\" + filename + "\\" + folderNumber,
        Dts.Variables["OutputMainFolder"].Value.ToString()  + "\\" + filename);
        Dts.TaskResult = (int)ScriptResults.Success;
    }

    #region ScriptResults declaration

    enum ScriptResults
    {
        Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
        Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    };
    #endregion

}
}

AnswerRe: Moving File to corresponding folders Pin
BillWoodruff13-Jun-18 22:41
professionalBillWoodruff13-Jun-18 22:41 
AnswerRe: Moving File to corresponding folders Pin
User 418025414-Jun-18 7:02
User 418025414-Jun-18 7:02 
Questionthe code c# below that does not compile Pin
Member 1366398513-Jun-18 6:06
Member 1366398513-Jun-18 6:06 
AnswerRe: the code c# below that does not compile Pin
OriginalGriff13-Jun-18 6:19
mveOriginalGriff13-Jun-18 6:19 
GeneralRe: the code c# below that does not compile Pin
Member 1366398513-Jun-18 16:10
Member 1366398513-Jun-18 16:10 
GeneralRe: the code c# below that does not compile Pin
OriginalGriff13-Jun-18 21:32
mveOriginalGriff13-Jun-18 21:32 
AnswerRe: the code c# below that does not compile Pin
Gerry Schmitz13-Jun-18 7:48
mveGerry Schmitz13-Jun-18 7:48 
GeneralRe: the code c# below that does not compile Pin
Member 1366398513-Jun-18 16:16
Member 1366398513-Jun-18 16:16 
QuestionHow to make an android phone does calls to people using vc#.net Pin
Mohammad Abdullaha11-Jun-18 22:13
Mohammad Abdullaha11-Jun-18 22:13 
AnswerRe: How to make an android phone does calls to people using vc#.net Pin
OriginalGriff11-Jun-18 23:03
mveOriginalGriff11-Jun-18 23:03 
GeneralRe: How to make an android phone does calls to people using vc#.net Pin
Mohammad Abdullaha12-Jun-18 3:58
Mohammad Abdullaha12-Jun-18 3:58 
GeneralRe: How to make an android phone does calls to people using vc#.net Pin
OriginalGriff12-Jun-18 4:37
mveOriginalGriff12-Jun-18 4:37 
AnswerRe: How to make an android phone does calls to people using vc#.net Pin
Pete O'Hanlon11-Jun-18 23:14
mvePete O'Hanlon11-Jun-18 23:14 
GeneralRe: How to make an android phone does calls to people using vc#.net Pin
Mohammad Abdullaha12-Jun-18 3:53
Mohammad Abdullaha12-Jun-18 3:53 
GeneralRe: How to make an android phone does calls to people using vc#.net Pin
Richard MacCutchan12-Jun-18 9:05
mveRichard MacCutchan12-Jun-18 9:05 
GeneralRe: How to make an android phone does calls to people using vc#.net Pin
Richard Andrew x6412-Jun-18 12:10
professionalRichard Andrew x6412-Jun-18 12:10 
GeneralRe: How to make an android phone does calls to people using vc#.net Pin
Richard MacCutchan12-Jun-18 21:13
mveRichard MacCutchan12-Jun-18 21:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.