Emacs Lisp: File and Directory Functions
Here's the most useful functions for file and directory.
Functions on File
Basic functions on file and directory.
file-exists-p
rename-file
-
(rename-file "~/test1.txt" "~/test2.txt")
copy-file
-
(copy-file "~/test1.txt" "~/test2.txt")
delete-file
-
(delete-file "~/test2.txt")
set-file-modes
Functions on Directory
directory-files
make-directory
delete-directory
-
delete a whole dir. new in emacs 23.
(delete-directory "~/stuff" t)
copy-directory
-
(copy-directory "~/stuff" "~/stuff-backup")