How to rename file with a new extention

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
optiquest
Newbie
Posts: 2
Joined: Wed Dec 28, 2005 4:46 pm

How to rename file with a new extention

Post by optiquest » Tue Jan 10, 2006 9:29 pm

Hi,
How can I check the directory for files, if the files let say "file.eps" in the directory, then the script will copy to the new directory "A" and create a new text file in a directory "B" with a .txt instead of eps "file.txt". then ftp it to a server.

I can copy the files but I dont know how to change .eps to .txt for every files

thank you

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Jan 17, 2006 2:38 pm

You can change the extension when you copy:

CopyFile>c:\dirA\file.eps,c:\dirB\file.txt

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 » Tue Jan 17, 2006 9:06 pm

Copying files can take up much time if files are large.
If you only want to rename the file, then use MoveFile with MF__RENAME like this:

Code: Select all

Let>MF_RENAME=1
MoveFile>B:\file.eps,B:\file.txt
...
...
//When done renaming all files, then set MF_RENAME back to default of 0
Let>MF_RENAME=0
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Jan 17, 2006 11:43 pm

But will that leave the .eps in directory "A"?

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Wed Jan 18, 2006 9:18 pm

No, but neither will a rename.

If you want a copy, use the CopyFile command. However, because the system has to duplicate each bit of data (instead of just changing the name of the file), it will take longer.

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