| View previous topic :: View next topic |
| Author |
Message |
fritz Guest
|
Posted: Thu Mar 24, 2005 11:51 am Post subject: How to rename some files with sequencial name? |
|
|
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
|
Posted: Thu Mar 24, 2005 12:45 pm Post subject: |
|
|
| Code: | | FileMove, A.txt, B.txt |
|
|
| Back to top |
|
 |
ILL.1
Joined: 29 Sep 2004 Posts: 84
|
Posted: Thu Mar 24, 2005 12:48 pm Post subject: |
|
|
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 |
|
 |
fritz Guest
|
Posted: Thu Mar 24, 2005 1:10 pm Post subject: bette |
|
|
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
|
Posted: Thu Mar 24, 2005 1:21 pm Post subject: P.S. |
|
|
| I'm not lazy, I'm not very smart..... |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Mar 24, 2005 4:49 pm Post subject: ????????????? |
|
|
| who???????? |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Thu Mar 24, 2005 7:39 pm Post subject: |
|
|
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
Schon gesehen --> [hier] ?
| 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
|
Posted: Thu Mar 24, 2005 8:18 pm Post subject: Thank you very much!!! |
|
|
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
|
Posted: Thu Mar 24, 2005 9:20 pm Post subject: |
|
|
Faz favor  |
|
| Back to top |
|
 |
fritz Guest
|
Posted: Fri Mar 25, 2005 1:24 am Post subject: sai cosa significa bobo in portoghese? |
|
|
| sai cosa significa bobo in portoghese? |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4078 Location: Pittsburgh
|
Posted: Sat Mar 26, 2005 3:50 am Post subject: |
|
|
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 |
|
 |
fritz Guest
|
Posted: Sat Mar 26, 2005 9:34 am Post subject: very intresting thank you! |
|
|
| very intresting, thank you! |
|
| Back to top |
|
 |
|