This add-in provides a script column IsEncrypted, which checks whether an archive is encrypted and requires a password to be opened.
The column returns one of four values:
| value | meaning |
|---|---|
| 1 | Archive is encrypted (or corrupted) |
| 0 | Archive is not encrypted |
| -1 | Not an archive (file or directory) |
| -2 | Error running 7z (e.g., 7z.exe not found) |
The script determines the encryption status by testing the file with 7-Zip using a dummy password and interpreting the result. If the archive cannot be opened, it is classified as encrypted. Note that this may also indicate that the file is corrupted.
How to set up and use
Download and install 7-Zip from 7-zip.org or run winget install --id 7zip.7zip.
Save ColumnIsEncrypted.js.txt toββββ
%appdata%\GPSoftware\Directory Opus\Script AddIns
Usage examples
- Toggle the column
Set COLUMNSTOGGLE="scp:IsEncrypted/IsEncrypted(!,a,0)"
- Find encrypted archives in the source
Find FILTERDEF script match IsEncrypted/IsEncrypted > 0
- Define a Filter Label
Things you might enjoy reading
How to use buttons and scripts from this forum
The script's inner workings
JScript
// return values:
// 1 Archive is encrypted (or corrupted)
// 0 Archive is not encrypted
// -1 Not an archive (file or directory)
// -2 Error running 7z (e.g., 7z.exe not found)
var fsu = DOpus.FSUtil();
var exe7z = fsu.Resolve('/programfiles\\7-Zip\\7z.exe');
function OnInit(initData) {
initData.name = 'IsEncrypted';
initData.version = '2026-06-17';
initData.url = 'https://resource.dopus.com/t/isencrypted-check-if-an-archive-is-encrypted/59753';
initData.desc = 'Check if an archive is encrypted';
initData.default_enable = true;
initData.min_version = '13.18';
}
function OnAddColumns(addColData) {
var col = addColData.AddColumn();
col.name = 'IsEncrypted';
col.method = 'OnColumn';
col.type = 'double';
}
function OnColumn(scriptColData) {
scriptColData.value = -1; // default value: not an archive
var item = scriptColData.item;
if (item.is_dir) return;
if (!item.InGroup('Archives')) return;
var cmdLine = '"' + exe7z + '"' +
' t "' + item + '"' +
' -pDummyPassword'; // Testing with a dummy password to check if the archive is encrypted. Please change the password if you happen to use this one ;-)
var result = fsu.Run(cmdLine, 0, true);
scriptColData.value = result ? result.exitcode ? 1 : 0 : -2;
}
