Where Dota 2 saves replays, and how long you can download them
The folder Dota 2 writes .dem replay files to, why the Download button disappears after a week or two, and how to keep a match before it expires.

When you press Download replay, the client fetches a compressed file from Valve’s replay servers, unpacks it and writes it to disk as a .dem file named after the match ID. A typical match is 30 to 60 MB. Nothing cleans that folder up for you, so files you downloaded months ago are probably still there.
Where the files are
The replays folder sits inside the Dota 2 install. With Steam’s default library on Windows that is:
C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\replaysOn Linux, with the default library:
~/.local/share/Steam/steamapps/common/dota 2 beta/game/dota/replaysIf you installed Dota on another drive, the part after steamapps is the same. The quickest way to get there without guessing is through Steam: right-click Dota 2, choose Manage, then Browse local files, and open game, then dota, then replays.
Each file is named <match id>.dem, for example 9052204107.dem. If you don’t know which number is which game, the match ID guide shows where to look it up.
How long Valve keeps replays
Valve doesn’t publish a retention period. Players report that ordinary matchmaking replays disappear somewhere between one and two weeks after the game, and that tournament matches stay up longer. Once the file is gone from Valve’s servers, the Download button disappears and the replay can’t be fetched again. Stats sites keep the scoreboard numbers but not the replay.
A file you already downloaded is not affected. It stays on your disk, and you can still open it with playdemo or upload it somewhere else.
Keeping a match for good
If a game matters to you (a tournament match, say, or a loss you want a coach to see), download it the same day. Then either copy the .dem out of the replays folder, since some players clear that folder to save space, or upload it to ReplayDojo. An uploaded replay gets its own page and link, so it stays watchable in a browser after Valve’s copy is gone.
Drop a .dem file onto the home page, or import a recent match by its ID.
Import a match