Skip to content

Filter files by checking if their modification times or MD5 checksums have changed.




filter_md5sum(files, db = "blogdown/md5sum.txt")



A vector of file paths.


Path to the database file.


The filtered file paths.


The function filter_newfile() returns paths of source files that do not have corresponding output files, e.g., an .Rmd file that doesn't have the .html output file.

The function filter_timestamp() compares the modification time of an Rmd file with that of its output file, and returns the path of a file if it is newer than its output file by N seconds (or if the output file does not exist), where N is obtained from the R global option blogdown.time_diff. By default, N = 0. You may change it via options(), e.g., options(blogdown.time_diff = 5) means an Rmd file will be returned when its modification time at least 5 seconds newer than its output file's modification time.

The function filter_md5sum() reads the MD5 checksums of files from a database (a tab-separated text file), and returns the files of which the checksums have changed. If the database does not exist, write the checksums of files to it, otherwise update the checksums after the changed files have been identified. When a file is modified, its MD5 checksum is very likely to change.

These functions can be used to determine which Rmd files to be rebuilt in a blogdown website. See build_site() for more information.