33 Votes

Insert File Name at the beginning of each Line of a Text File

Question by Mail Request | 2016-01-07 at 15:16

I have to insert the file name of the text file at the beginning of each line of this file.

For this, I have activated the function "Insert" within the TextConverter and under "Insert this Text", I have specified "%File%". Additionally, I have selected the options "At the start" and "of each Line".

Unfortunately, this is not working. Can someone help me?

ReplyPositiveNegativeDateVotes
3Best Answer3 Votes

There are two possible reasons why your solution is not working:

  • The name of the constant is %file%, you are using the placeholder %File% instead.
  • Have you activated the checkbox before "Constants" in order to specify that constants should be used?

If you keep those things in mind, it should work.
2016-01-07 at 15:19

ReplyPositive Negative
22 Votes

My old answer from 2016 referred to the current version of the TextConverter at that time. However, in the meantime, the program has changed a lot.

With the current version you can proceed as follows to insert the file name at the beginning of each line:

  • Activate placeholders via "Actions > Options > Placeholders" by placing the hook in front of "Placeholders".
  • Activate the action "Actions > Lines > Prepend Text".
  • Within this action, activate "According to Line Numbers" and "In all Lines".
  • Write the placeholder "%filename%" into the field "Prepend this Text to the Front".

With the placeholder %filename%, the file name with its file extension is inserted. If you do not need the file extension, you can use the placeholder %name% instead to insert the file name without its ending. If you want to insert the file name including its path, just use the placeholder %filepath%.

In the overview over all available placeholders of the TextConverter you can find a list as well as further explanations of the available placeholder.
2022-11-23 at 18:39

Positive Negative
Reply
Reply

Related Topics

Rename File to its Folder Name

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.