Connecting Tech Pros Worldwide Forums | Help | Site Map

Filename Increments

benchpolo's Avatar
Member
 
Join Date: Sep 2007
Location: Nevada
Posts: 92
#1: Jul 8 '09
I have an automated process that I need to produce incremental filenames so that when the sql process runs multiple times the file will be incremented, but I cannot find or figure out how to write this code.

For example, arcca_daily_incoming_1.asc , this is the filename for the first run then when the process executes again on the same the the filename would be arcca_daily_incoming_2.asc then arcca_daily_incoming_3.asc .. make sense?

Can someone assist me with the code or point me where I can mirror the code? I have never written this kind of process before.

You assitance will be appreciated.

Thanks.

ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,992
#2: Jul 8 '09

re: Filename Increments


Will the process execute once, meaning all these files will be created at once? Or your process will execute in a defined frequency that it will start from the last file created from the previous process and go from there?


--- CK
benchpolo's Avatar
Member
 
Join Date: Sep 2007
Location: Nevada
Posts: 92
#3: Jul 8 '09

re: Filename Increments


The process is automated so if it runs succesfully for that day it will be arcca_daily_incoming_1.asc, but if the automated process is run manually it should not create arcca_daily_incoming_1.asc instead it should increment to arcca_daily_incoming_2.asc
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,992
#4: Jul 8 '09

re: Filename Increments


In that case, you have to check first if there are existing files on your target folder. If there are, you have grab the last increment number and start from there, if no file are existing, start from 1, then loop. You have to do all this using dynamic query.

Happy Coding!

--- CK
Newbie
 
Join Date: Jun 2008
Posts: 25
#5: Jul 29 '09

re: Filename Increments


Perhaps it would be more useful if you used a time/date combination to name your erudite files. As your process continues to run, filename_#.ext becomes less useful to placing the file name into a useful context such as when an event/error occurred.

That's it. I'm out of change.

That was my last two cents.
Reply