Is there a fast (automatic) way to create one long file from all of the files in a directory using emacs? IE
>Text_1.txt
>{contents of Text_1}
>Text_2.txt
>{contents of text2}
>FinalResult.txt
>{contents of Text_1
>contents of Text2}
How about this:
(defun insert-my-files ()
(interactive)
(let ((dir (read-directory-name "Directory to insert: ")))
(mapc #'(lambda (file)
(let ((file-full (concat dir file)))
(insert-file-contents file-full)))
(cddr (directory-files dir)))))
Call it with M-x insert-my-files
, and it will insert the contents of the directory you supply.
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