diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
index ee112eb69d2aaed1ceb6922cb9c2cbc3fd893a0b_aGdleHQvbGFyZ2VmaWxlcy9sZnV0aWwucHk=..db8b0ee74025f77c02b3cc9f183aca720f41a400_aGdleHQvbGFyZ2VmaWxlcy9sZnV0aWwucHk= 100644
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -110,7 +110,9 @@
         repo.ui.note(_('Found %s in store\n') % hash)
     elif inusercache(repo.ui, hash):
         repo.ui.note(_('Found %s in system cache\n') % hash)
-        link(usercachepath(repo.ui, hash), storepath(repo, hash))
+        path = storepath(repo, hash)
+        util.makedirs(os.path.dirname(path))
+        link(usercachepath(repo.ui, hash), path)
     else:
         return None
     return storepath(repo, hash)