Author |
Topic |
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2012-01-29 : 13:07:49
|
How to move the oldest 1000 files from a folder that contains 10000 files.The file names are tickcounts with extension xml.Thank yousarah |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-29 : 14:17:47
|
does file name contain timestamp information?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2012-01-29 : 16:33:19
|
No the name is produced by gettickcountThanksarah |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-29 : 16:48:00
|
so what will be a typical filename? is there anything in it from which you can derive the sequence of arrival?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2012-01-29 : 16:56:05
|
I will send an example within an hour it is a long number that can never be repeatedThankssarah |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2012-01-29 : 17:29:14
|
It is increasing but it is a long number Thankssarah |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2012-01-29 : 18:07:38
|
Can I sort descending by the time they reach our folder in nano secondsarah |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-29 : 18:23:52
|
but do you've the time stored somewhere?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2012-01-29 : 22:11:51
|
Hi the sample of filesfile name:1327338235762.xml has in its content <datetime>2012-01-23T09:03:45</datetime>file name:1327338263700.xml has in its content<datetime>2012-01-23T09:04:14</datetime>file name:1327338353934.xml has in its content<datetime>2012-01-23T09:05:37</datetime>file name:1327338354700.xml has in its content <datetime>2012-01-23T09:05:37</datetime>file name:1327338504372.xml has in its content<datetime>2012-01-23T09:07:59</datetime>The other issue is that files are continuously coming so when I try to read file it says it is used by another user if a file name is like the ones i mentioned above shall I sort by file name ascending so the new ones will be at the end so I will not have the error message that it is used by another userThank you so much for your helpsarah |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-29 : 22:18:21
|
what you can do is set up a for each loop in ssis to read through files. inside loop, as a first step retrive filename and populate a table with it. During each iteration take only those files which are not present in table. this will avoid same file been taken again. for sorting use number in filename and then generate sequence number based on that. then put a loop to delete all files which come in the beginning upto limit you want (1000 or something)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2012-01-29 : 22:32:14
|
Thank yousarah |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-29 : 22:51:38
|
let us know how you get on------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|