Determine whether a file exists
(File-exists-P "~ /Test. El ")
See its help documentation:
File-exists-P is a built-in function in 'C source Code '. (file-exists-P filename) return T if file filename exists (whether or not you can read it .) see also 'file-readable-p' and 'file-bubutes '. this Returns nil for a symlink to a nonexistent file. use 'file-symlink-p' to test for such links.
If yes, t is returned.
Check whether a file exists and is readable
(File-readable-P "~ /Test. El ")
Check file attributes
(File-attributes "~ /Test. El "'string)
Or
(File-attributes "~ /Test. El "'integer)
The list in the above two rows displays the object attributes in the form of string or integer list, ranging from 0 to 11, with a total of 12 attributes.
You can obtain whether a file is a directory.
Example of a directory operation
Assume that the sub-directory names in a directory are all numbers, and find the directory name with the largest number.
(Setq file-name-List (directory-Files "/opt/share/upland_release" nil "[0-9] +" 'nosort )) (string-to-number (CAR file-name-list ))
For other file functions, see
The file-related chapter for the http://www.gnu.org/software/emacs/manual/html_mono/elisp.html.