Create one TxT by adding up many Txt ,Problem: wrong order 1,10,11 instead of 1,2,3,4 in the new txt

Hello

I have a Folder with txts named 1.txt ,2.txt,… and so on. Sorted in the way I want.
23 Files, created from a pdf with 23 pages.

Workflow: For each file in Folder ->Read text file → append line

The created txt has the pages sorted wrong. 1,10,11,12,…19,2,20,21,22,23,3,4,5,6,7,8,9

Ideas why this is messed up ?

I didn’t know the studiox but I can tell the logic.

Count the no of pages in PDF

Loop through each pages and take the data from there and write in a text file with name as pagenumber of pdf file through which it is iterating.

I think u should use write text file there.

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

doesn´t write text file delete all previous data ?

I will try it out.

edit: doesn´t work because it deletes the previos content

maybe I should get the files in order without numbers, but I will have documents with hundreds of pages :confused:

Are these files arranged in order. Just check once if the files named and page numbers matches

The files in the folder are in order , thats why i dont understand why they are not in order in the final file.

Thinking about rennaming them a,b,c,…,aa,ab like in EXCEL and try if this works.

Use assign activity in that assign directory.getfiles(“path of files”) to a variable.
Then use append text and take path from above variables

1 Like

I`ll try to use word files, maybe this works.

edit: will try your solution if the word one doesn´t work

I tried to use a freeware tool on the txts and it produced the same error , really strange.

@Nils_Berns
the files are ordered in that way as it is lexically ordered (Line 1)
grafik

when we sort string numbers by a conversion to e.g. Int then the sort order is as expected 1<2<10
(Line 2)

Another way to handle a lexically ordered sequence is to left pad it (line3)

2 Likes

Hi @Nils_Berns … Please try with order by “Created Date oldest first” … I recently faced this error in Studio where I fixed this using order by create time and it solved. But in StudioX I do not see the create time. So please try this.

image

Are you trying to merging the file after you append the text?

In the mean time, I will check something here.

1 Like

@Nils_Berns
Another way to handle a lexically ordered sequence is to left pad it. have a look here:
grafik

maybe you can incorporate it by the editing / creating the filenames

1 Like

I treid that, but unfortunately it didn´t work.

Link to the prgramm: Dropbox - AddText_PDFv2.rar - Simplify your life

I think that could work but I´m not experienced enough for this way.

I´ll try to go page by page now.

I have put all the actions in the first for every file in folder action , now I must find a way to delete the split pdfs and txts after creation so they didn´t get added up to often.

I checked your zip file and the output…everything has been matching with your pdf content…i checked page by page…I am still not sure, what is the problem here?

I also sent a private message , please check your notifications.

the order in the fodlers is correct but the final txt has a messed up order of pages

@Nils_Berns … Oh ok. got it now… what activity you used to combined the text files??

I solved it now!
switched to step by step process and deleting the split parts worked.

I used append line for all files in the folder with the txts

link solution: Dropbox - AddText_PDFv3.rar - Simplify your life

1 Like