Newbies ryank Posted March 19, 2004 Newbies Posted March 19, 2004 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!
CyborgSam Posted March 20, 2004 Posted March 20, 2004 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
Recommended Posts
This topic is 7552 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now