I need help with truncate and rename files

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

I need help with truncate and rename files

Post by timle » Wed May 04, 2005 4:39 pm

I have files that have this long name format
xx_0504_01_tra_xxxx_xx.ps

I would like to automatically change to

travel_0504_p01.ps

Would you help me program this?
thank you very much

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed May 04, 2005 9:43 pm

Here is the renaming portion for you.

Code: Select all

Let>OldFile=xx_0504_01_tra_xxxx_xx.ps
MidStr>%OldFile%,4,4,core1
MidStr>%OldFile%,9,2,core2
Let>NewFile=travel_%core1%_p%core2%.ps
Message>Old file %OldFile%%CRLF%has been renamed to%CRLF%%NewFile%
You may need to loop through a directory to get the OldFile names. See help on GetFileList command and use the programming above for each filename.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

thankyou

Post by timle » Thu May 05, 2005 3:41 pm

Thank you Bob, I will try it

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts