I have a folder that contains more than 200 text file (.txt)
I want an easy way to add each file name to the first line of each file.
example I have a file called "I am a file.txt"
with the following content:
"
I am line one
I am line two
"
this should become something like this:
"
I am a file
=====
I am line one
I am line two
"
I'm wondering if someone could help me build a batch script that does that.
the reason for that is I want to upload all my text files to Evernote. But Evernote doesn't read the file name, instead it name the note as the first line in the text.
That worked for me:
(just past this in a file called whatever.bat and run it)
@echo off
for /f "eol=: delims=" %%F IN ('dir /b /s "C:\Users\MyPC\Desktop\myDir\*.txt"') do (
(
echo %%~nF
echo ___________________________
type "%%F"
)>"%%F.new"
move /y "%%F.new" "%%F"
)
pause
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With