How can I find out the total content size in a particular publication (all Tridion items) or in the entire Tridion system (All publications)? Please suggest.
From your comments, I am gathering that you are not looking for the number of items in the CM, but rather the disk space the Tridion items occupy. You can't get this using the Core Service API. This is rather a SQL server question, but to get the size of the Tridion CM database, we can use the stored procedure
sp_spaceused to get the size that the CM database occupies. More about this stored procedure is here: https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-spaceused-transact-sql?view=sql-server-ver15.
If you looking for the size of specific items you'd have to create custom queries using the
DATALENGTH function that returns the size in bytes (https://docs.microsoft.com/en-us/sql/t-sql/functions/datalength-transact-sql?view=sql-server-ver15). Something like this:
SELECT (SUM(DATALENGTH([CONTENT]))/1024.0/1024.0/1024.0) as [CONTENT_SIZE_IN_GB] FROM [Tridion_cm].[dbo].[BINARIES]
Well, there is easy way and a hard way.
Easy way is to check Tridion CM database, check number of items in ITEMS database (exclude versions and just check latest versions). Also exclude if you want local copies. Filter by publication or check all.
Hard way is to check using Core Service, and it is the only supported way. For this there are many examples and you can even find some here on stack. All you need to do is use filters, and you are good to go.