Sign in to follow this  
Followers 0
qwertylol

renaming files

8 posts in this topic

how do i write a script to rename every file in a folder to 1.txt ~ 999.txt?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try to use _FileListArray(). There are few topics in the example forum.

Edited by Generator

Share this post


Link to post
Share on other sites

Because AutoIt lacks a "FileRename" function, use FileMove to rename a file!

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Because AutoIt lacks a "FileRename" function, use FileMove to rename a file!

8)

uh i am very out of it, i get it to use *.txt in the "source", but i am not sure about dest

Share this post


Link to post
Share on other sites

uh i am very out of it, i get it to use *.txt in the "source", but i am not sure about dest

Do

Filemove ( "source", "dest" )

Filemove ( "*.txt", "$counter + txt" )

Until done

how do i write the "dest" part?

Share this post


Link to post
Share on other sites

Put them in @TempDir

Share this post


Link to post
Share on other sites

Dim $counter = 0

Do

Filemove ( "*.txt", $counter & '.txt')

$counter = $counter + 1

Until $counter = 344

Share this post


Link to post
Share on other sites

Dim $counter = 0

Do

Filemove ( "*.txt", $counter & '.txt')

$counter = $counter + 1

Until $counter = 344

You could run into some serious issues with what you have there, better think through your logic a tad.
#include <file.au3>
$aArray = _FileListToArray(@ScriptDir, '*.txt')
For $iCC = 1 To UBound($aArray) - 1
    FileMove(@ScriptDir & '\' & $aArray[$iCC], @ScriptDir & '\' & $iCC & '.txt')
Next

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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