diff --git a/conda/clean-betas.py b/conda/clean-betas.py
index 75a09e9f5e7aa547df32e7b04e9c8e8d26019e9c..b2950b7e2d1db6c791d7a2da06ca961e6feb6873 100755
--- a/conda/clean-betas.py
+++ b/conda/clean-betas.py
@@ -17,9 +17,11 @@ def main(scandir, dry_run):
       if f.startswith('.'): continue
       if not f.endswith('.tar.bz2'): continue
       name, version, build_string = f[:-8].rsplit('-', 2)
-      build = build_string.rsplit('_')[-1]
+      hash_, build = build_string.rsplit('_')
+      pyver, _ = hash_.rsplit('h', 1)
 
       name = os.path.basename(path) + '/' + name
+      if pyver: name += '/' + pyver
       target = os.path.join(path, f)
       betas.setdefault(name, []).append((
         StrictVersion(version),