AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to rename some files with sequencial name?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
fritz
Guest





PostPosted: Thu Mar 24, 2005 11:51 am    Post subject: How to rename some files with sequencial name? Reply with quote

Excuse me but I have a new problem:

How to rename some files with sequencial name or date/time?


Thanks
Back to top
BoBo
Guest





PostPosted: Thu Mar 24, 2005 12:45 pm    Post subject: Reply with quote

Code:
FileMove, A.txt, B.txt
Back to top
ILL.1



Joined: 29 Sep 2004
Posts: 84

PostPosted: Thu Mar 24, 2005 12:48 pm    Post subject: Reply with quote

Look under the index in the help file for A_Now and Rename. They should give you a hint on how to rename files and also use variables within filenames.

Simple example of variable usage:
Code:
Word1 = This
Word2 = is
Word3 = an
Word4 = example
Word5 = of
Word6 = variable
Word7 = output.

MsgBox, %Word1%%A_Space%%Word2%%A_Space%%A_Space%%Word3%%A_Space%%Word4%%A_Space%%Word5%%A_Space%%Word6%%A_Space%%Word7%


Word 1-7 are user defined variables, whereas variables such as A_Space and A_Now are built in variables. There are pleanty of example to help get you started, just give the help file a chance.
_________________
===============
----------ILL.1-----------
===============
Back to top
View user's profile Send private message
fritz
Guest





PostPosted: Thu Mar 24, 2005 1:10 pm    Post subject: bette Reply with quote

I have many problem with english. (and AHK too!!)

In a directory F:\Hotkey\ I have some files es:
aaa.txt
bbb.txt
ccc.txt

I want trasform this files in:

1000.txt
1001.txt
1002.txt
(because I have a program who ouput files with the same name)

Have a solution?
Please working example, I' very very newbie!
Thanks!
Back to top
fritz
Guest





PostPosted: Thu Mar 24, 2005 1:21 pm    Post subject: P.S. Reply with quote

I'm not lazy, I'm not very smart.....
Back to top
Guest






PostPosted: Thu Mar 24, 2005 4:49 pm    Post subject: ????????????? Reply with quote

who????????
Back to top
BoBo
Guest





PostPosted: Thu Mar 24, 2005 7:39 pm    Post subject: Reply with quote

Da bei den Alliierten der Name "Fritz" als Synonym für "die Deutschen" stand/steht, vermute ich das du deine Problemstellung möglicherweise besser auf Deutsch erklären kannst!? Wenn ja, schieß los Razz
Schon gesehen --> [hier] ? Wink

Code:
Loop *.txt ; lese alle text dateien nacheinander
{
FCount  ++ ; dateizähler
SetFormat, float, 04.0 ; zählerformat 4stellig mit führenden nullen
FCount += 0.0 ; format der variablen zuweisen
FileMove, %A_LoopFileName%, %FCount%.txt ; datei umbenennen
}
Back to top
fritz
Guest





PostPosted: Thu Mar 24, 2005 8:18 pm    Post subject: Thank you very much!!! Reply with quote

Many Thank; is perfect!!!

Your deduction its half right, I am half Deutsch but Unfortnelly I don't speak Deutsch; only speak Italian & Brasilian Portuguese.

Bye!
Back to top
BoBo
Guest





PostPosted: Thu Mar 24, 2005 9:20 pm    Post subject: Reply with quote

Faz favor Wink
Back to top
fritz
Guest





PostPosted: Fri Mar 25, 2005 1:24 am    Post subject: sai cosa significa bobo in portoghese? Reply with quote

sai cosa significa bobo in portoghese?
Back to top
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Sat Mar 26, 2005 3:50 am    Post subject: Reply with quote

You might get unpleasant surprises if there are number filenames already in the directory (that is, if you run the script a second time). In a similar case my script created a subdirectory named with the current date and time and moved the files into this new directory, without changing their names. This way I kept all the versions of the files, separated. Another possibility is to attach to the filename the date and time when it was last modified. You could check first if the filename has already this attached time info.

Theoretically, you could still get collisions. Maybe, the best is to rename and move your files into an empty temporary directory (specifying the explicit path), delete the now empty original directory and rename your temporary directory to the name of the original. When making the temporary directory, you have to check the error level, to see if there was a name collision. In that case try another directory name, like Fritz0001, Fritz0002, etc., until there is no problem with creating it.
Back to top
View user's profile Send private message
fritz
Guest





PostPosted: Sat Mar 26, 2005 9:34 am    Post subject: very intresting thank you! Reply with quote

very intresting, thank you!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group