Checksums
Another very common requirement for builds is generating checksums on your files. We've got you covered here now as well. Run checksum help for even more options.

From the CLI

1
checksum file.txt
2
checksum path=build.zip algorithm=SHA-256
Copied!

From CFML

1
command( 'checksum' )
2
.params( 'file.txt' )
3
.run();
4
5
command( 'checksum' )
6
.params( path = 'build.zip', algorithm = 'SHA-256' )
7
.run();
Copied!

Checksum all files in a directory

You can provide a file globbing pattern to receive a checksum for all files in a directory that match that pattern.
1
checksum *.cfc
Copied!

Output format

The checksum command also supports some other popular formats for outputting checksums. The default format is checksum.
1
checksum path=**.cfc format=checksum
2
checksum path=**.cfc format=sfv
3
checksum path=**.cfc format=md5sum
Copied!

Write out checksums

The checksum command will also write out a file that contains the hash which is a common requirement for builds that produce artifacts.
Write checksum(s) to a file named after the original file plus a new extension. This will create a file called myFile.zip.md5.
1
checksum myFile.zip md5 --write
Copied!
Control the file extension like so. (--write is optional when supplying an extension) This will create a file called myFile.zip.hash.
1
checksum path=myFile.zip extension=hash --write
Copied!

Verify a file against an existing checksum

You can check a file against an existing checksum to make sure the file hasn't changed.
1
checksum path=myFile.zip verify=2A95F32028087699CCBEB09AFDA0348C
Copied!