A Python utility that scans Steam libraries and displays detailed information about installed games.
Find large games, check storage usage, view installation paths and get a complete overview of your Steam collection.
Useful for users with multiple drives, large game libraries and limited disk space.
Features:
- Automatically detects Steam libraries
- Scans installed Steam games
- Shows game name and AppID
- Calculates game size
- Displays installation path
- Sorts games by size
- Shows total disk usage
- Finds the largest installed game
- Creates TXT report
- Supports multiple Steam libraries
Requirements:
Python 3.x
No external libraries required.
Usage:
Code:
python steam_library_scanner.py
Example Output:
Code:
==================================================
Steam Library Scanner
==================================================
Scanning Steam libraries...
Game:
Cyberpunk 2077
AppID:
1091500
Size:
86.4 GB
Location:
D:\SteamLibrary\steamapps\common\Cyberpunk 2077
--------------------------------------------------
Game:
Counter-Strike 2
AppID:
730
Size:
38.2 GB
Location:
C:\Steam\steamapps\common\Counter-Strike 2
==================================================
Games Found: 15
Total Usage: 524.7 GB
Largest Game:
Cyberpunk 2077
Report:
steam_library_report.txt
==================================================
Code:
Code:
import os
import re
import time
def format_size(size):
for unit in ["B", "KB", "MB", "GB", "TB"]:
if size < 1024:
return f"{size:.2f} {unit}"
size /= 1024
return f"{size:.2f} PB"
def get_folder_size(path):
total = 0
try:
for root, dirs, files in os.walk(path):
for file in files:
try:
total += os.path.getsize(os.path.join(root, file))
except:
pass
except:
pass
return total
def find_steam_path():
paths = [
os.path.expandvars(r"%ProgramFiles(x86)%\Steam"),
os.path.expandvars(r"%ProgramFiles%\Steam"),
os.path.expandvars(r"%LocalAppData%\Steam")
]
for path in paths:
if os.path.exists(path):
return path
return None
def parse_value(text, key):
match = re.search(
rf'"{key}"\s+"([^"]+)"',
text
)
if match:
return match.group(1)
return None
def get_library_paths(steam_path):
libraries = []
vdf = os.path.join(
steam_path,
"steamapps",
"libraryfolders.vdf"
)
if not os.path.exists(vdf):
return libraries
try:
with open(
vdf,
"r",
encoding="utf-8"
) as f:
data = f.read()
paths = re.findall(
r'"path"\s+"([^"]+)"',
data
)
for path in paths:
libraries.append(
path.replace("\\\\", "\\")
)
except:
pass
if steam_path not in libraries:
libraries.append(steam_path)
return libraries
def get_games(library):
games = []
steamapps = os.path.join(
library,
"steamapps"
)
if not os.path.exists(steamapps):
return games
for file in os.listdir(steamapps):
if file.startswith("appmanifest_") and file.endswith(".acf"):
try:
path = os.path.join(
steamapps,
file
)
with open(
path,
"r",
encoding="utf-8",
errors="ignore"
) as f:
data = f.read()
appid = parse_value(
data,
"appid"
)
name = parse_value(
data,
"name"
)
installdir = parse_value(
data,
"installdir"
)
if name and installdir:
game_path = os.path.join(
steamapps,
"common",
installdir
)
size = get_folder_size(
game_path
)
games.append(
{
"name": name,
"appid": appid,
"size": size,
"path": game_path
}
)
except:
pass
return games
def save_report(games):
with open(
"steam_library_report.txt",
"w",
encoding="utf-8"
) as f:
f.write(
"Steam Library Scanner Report\n"
)
f.write(
"=" * 40 + "\n\n"
)
for game in games:
f.write(
f"Game: ******['name']}\n"
)
f.write(
f"AppID: ******['appid']}\n"
)
f.write(
f"Size: {format_size(game['size'])}\n"
)
f.write(
f"Path: ******['path']}\n"
)
f.write(
"-" * 40 + "\n"
)
def main():
print("=" * 60)
print(" Steam Library Scanner v1.0")
print("=" * 60)
steam = find_steam_path()
if not steam:
print("\nSteam installation not found.")
return
print("\nSteam found:")
print(steam)
print("\nScanning libraries...\n")
libraries = get_library_paths(
steam
)
games = []
for library in libraries:
games.extend(
get_games(library)
)
games.sort(
key=lambda x: x["size"],
reverse=True
)
print("=" * 60)
if not games:
print("No games found.")
return
total = 0
for index, game in enumerate(games, 1):
total += game["size"]
print(
f"""
#{index}
Game:
******['name']}
AppID:
******['appid']}
Size:
{format_size(game['size'])}
Location:
******['path']}
"""
)
print("-" * 60)
print("=" * 60)
print("Summary")
print("=" * 60)
print(
f"Games Found: {len(games)}"
)
print(
f"Total Usage: {format_size(total)}"
)
print(
f"Largest Game: {games[0]['name']}"
)
save_report(
games
)
print(
"\nReport saved: steam_library_report.txt"
)
print(
"\nDone."
)
if __name__ == "__main__":
main()