Elisp: Get File Info
Get File Info
file-exists-p
file-directory-p
directory-empty-p
file-symlink-p
file-regular-p
file-in-directory-p
file-readable-p
file-executable-p
file-writable-p
file-accessible-directory-p
file-modes
File Size, Date, Owner, etc
file-attributes
-
(file-attributes FILENAME &optional ID-FORMAT)
Return a list of attributes of file FILENAME. e.g.
file-attribute-type
file-attribute-link-number
file-attribute-user-id
file-attribute-group-id
file-attribute-access-time
file-attribute-modification-time
file-attribute-status-change-time
file-attribute-size
file-attribute-modes
file-attribute-inode-number
file-attribute-device-number
see emacs lisp manual
;; get file size in bytes (let ((xfileAttr (file-attributes "~/.emacs.d/init.el"))) (file-attribute-size xfileAttr)) ;; sample value ;; 162
Reference
Elisp, File, Buffer
- Elisp: Buffer Functions
- Elisp: Read File
- Elisp: Read File Content as String or Lines
- Elisp: Write File
- Elisp: Open File, Read, Possibly Write
- Elisp: File and Directory Functions
- Elisp: Get File Info
- Elisp: File Path Functions
- Elisp: Walk Directory, List Files
- Elisp: Walk Directory by Depth 🚀
- Elisp: Get Dired Marked Files