Append text to the beginning of a text file.

So, I know how to write new data to the end of an existing text file. Is there a way to add it to the top of the text file? pushing existing text down? This is for a log of paste and deleting activity and I’d like it to read most recent activity at the top.



there is no built-in command to insert text with AppleScript’s read/write capabilities,
you have to script it
This example creates 10 new lines with the most recent one at the top

set s to "new line "
repeat with i from 1 to 10
	set ff to open for access file ((path to desktop as Unicode text) & "test_insert.txt") with write permission
		set t to read ff
	on error
		set t to ""
	end try
	write (s & (i as text) & return & t) to ff starting at 0
	close access ff
end repeat

perfect. Thanks!