Link to home
Create AccountLog in
Avatar of Fatehbourghoud
Fatehbourghoud

asked on

SSIS-C# Sort and load files by dateCreation

Hi Expert ;

I have  files

Test_503_20101207_114812.CSV
Test_503_20101207_115012.CSV
Test_502_20101207_114812.CSV
Test_502_20101207_115012.CSV


the name is build as follow

Test= Prefix
502 and 503 = Store Code
20101207 = Date
114812 = Time

01- I want to verifiy If we have in the directory at least one file for each Store Code
 ex : verify if  Test_502_20101207_114812.CSV and Test_503_20101207_114812.CSV exist in the dirctory ( Folder )


02- Log the missing Store file in  txt file

03- keep the first created file in the same directory for each Store Code and move the others to an other directory  ex :
Test_503_20101207_114812.CSV
Test_503_20101207_115012.CSV
 keep the Test_503_20101207_114812.CSV and move the Test_503_20101207_115012.CSV

How to do that with C# in SSIS Script Task , thank's to give me the C# Code

Regards
Avatar of Reza Rad
Reza Rad
Flag of New Zealand image

your question is not clear to me,
do you want to check for missing store codes for each Date or at all?
Avatar of Fatehbourghoud
Fatehbourghoud

ASKER

Hi reza ;

My client has two stores ( 502 and 503 ) he has to provide me two daily sales files  one for store 502 and other for store 503 ( Test_502_20101207_114812.CSV and Test_503_20101207_114812.CSV ) the script need to verify if the two files exist in the directory ( Folder ) and if by error the client provide one of these files twice I have to keep th first created file and move the duplicated one to an other folder.

If any question or the specification steel not clear let me know

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Reza Rad
Reza Rad
Flag of New Zealand image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Reza_rad Is the best