Sign in to follow this  
Followers 0
strate

How to rename a file

12 posts in this topic

Is it possible to rename a file? I have a .txt and I want to rename it as a .def how would I do this?


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites



rename *.txt *.def


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

If you want to use AutoIt use FileCopy. You have to be kinda creative with the functions we have, and think outside the box to apply them to what you need. :)

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

rename *.txt *.def

<{POST_SNAPBACK}>

?? Is that a feature ??

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

No AutoIt does not have a "rename" function. To accomplish this in AutoIt do As I posted above.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

CORRECTION: Sorry brainfart... you need to use FileMove so you dont have 2 files. Example:

FileMove("C:\MyFile.txt", "C:\MyNewFile.def")

That should work... it is untested but check the helpfile for more assistance.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

CORRECTION: Sorry brainfart... you need to use FileMove so you dont have 2 files. Example:

FileMove("C:\MyFile.txt", "C:\MyNewFile.def")

That should work... it is untested but check the helpfile for more assistance.

*** Matt @ MPCS

<{POST_SNAPBACK}>

It seems weird that when you've read the help file forty thousand times the simple solutions don't come to mind. Well for me anyways. Sorry the FileCopy worked perfect. The extra file is fine I can keep a record of what the operater did.

Thanks again.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

yeah it works. what i suggested works in %comspec%


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

yeah it works. what i suggested works in %comspec%

<{POST_SNAPBACK}>

Please explain more about what you mean.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Please explain more about what you mean.

<{POST_SNAPBACK}>

he means: run the Good Old dos command rename or ren.

runwait(@comspec & " /c rename from.txt to.def')
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Also jumping from Matt's example you could use the following :)

FileMove("C:\YourFile.txt", "C:\*.def")

That way it keeps the same file name...

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

actually changes the extension....

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0