remove the filename from a string

I have a string like this /Development/ST/st000001su/Outbound/Prod/PROD-732QCJ/63acf2caf91bc136cb9bcce8a85c7fa8/PGP/PGP.txt

I want to remove the PGP.txt and I want only the /Development/ST/st000001su/Outbound/Prod/MCFR-732QCJ/63acf2caf91bc136cb9bcce8a85c7fa8/PGP returned.

I saw an command called basename in this forum, but that gives the filename.

I dont need the filename but need the directory name.

dirname

If you already have the string in a variable:

directory=${filename%/*}

Regards,
Alister