March 19, 200421 yr Newbies I have had quite the dilemma trying to create a script to rename my files. I have a folder every day with a group of files: k19pe001.vit <---the "19" reprensents the day of the month k19pe002.vit k19pe003.vit k19pe004.vit {and so on...} which i need to rename as e 01.vit0317 <---the "0317" refers to the month (03) and the day (17) e 02.vit0317 e 03.vit0317 e 04.vit0317 {and so on...} i figured that I could wilcard out the "k19" prefix, as it changes daily, creating the new names of the files seems impossible, since "0317" stands for the month and the day, and I would have to alter the script daily to do this... Is altering the script daily the only solution to my problem?? Thanks!
March 20, 200421 yr Assuming you have a variable in your script called "theFilename", you can add the date with these steps (programmed for learning, not optimization): set RightNow to current date -- don't use (current date) more than once in a routine, time could tick while executing copy ((offset of (the month of RightNow) in "jan feb mar apr may jun jul aug sep oct nov dec ") + 3) / 4 as integer to theMonth if theMonth < 10 then copy "0" & theMonth as text to theMonth copy day of RightNow to theDay if (day of RightNow < 10) then copy "0" & theDay as text to theDay set theFilename to theFilename & theMonth & theDay
Create an account or sign in to comment