1000 files, increment each first line number by 1
-
@dajaridi to make sure I understand this, you have 100 .txt files and you would like to rename all the txt files by adding a counter in front of the name right, 001 filename.txt, 002 filename.txt and so on
-
@Javier-Rivas No, not the text file name itself, but the first line of text in each file.
-
You can add the source of the batch file by adding
~~~
.
before and after the source, but you can’t attach files to the post.
For example@echo off set X=%%1 ...
But I think OP is asking about manipulating the file contents
instead of the individual file names. -
@dajaridi the context of a file, like you are editing a txt files and inside you have
Example
I am
John
SmithAnd in front of that you want a counter
001 I am
002 John
003 SmithLike it’s counting rows, if please give an example
-
@Ekopalypse Yes, adding a number starting with 000, last being 999 to the first line of text. Thanks for contributing
-
@dajaridi ok, ok I think I got only the first line, only the first line of context on each txt file
-
All files have the first line: first_line_of_text_
and would like to make the first line of each file:
the_first_file.txt
first_line_of_text_000the_second_file.txt
first_line_of_text_001 -
@Javier-Rivas Yes!
-
@dajaridi my files do that but for file names, I’ll do my best to help you
-
@Javier-Rivas If you have an idea that might help, I would be thankful>
For renaming a number of files I use a very useful utility called BulkRename Utility. -
@Javier-Rivas I have been able to achieve my objext using notepad++ although it is quite inelegant.
I have a folder with 1000 text files, which I duplicated. I then renamed them with a suffix 000.txt -> 999.txt
Each file has a unique first line, with a name and number, and all I did was do a search and replace to add in an extra zero and change the _001 to _0001
It will give me a unique first line, but will be a little more messy when combine with the other folder – but will work for what I am after.
Thanks for your help!! Most appreciates.
Daja
PS I know I’ve done it before, and it’s driving me nuts that I don’t remember how or where I found it…