diff --git a/archive/search.html b/archive/search.html
deleted file mode 100644
index 328e153..0000000
--- a/archive/search.html
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
- Search
-
-
-
-
-
-
-
-
- OSF Mirror Search
-
-
-
-
-
-
-
- This page is a read-only mirror of the OSF. Some features may not be available.
-
-
-
-
\ No newline at end of file
diff --git a/scripts/make_flat.py b/scripts/make_flat.py
index 956b0a1..f4991b4 100644
--- a/scripts/make_flat.py
+++ b/scripts/make_flat.py
@@ -1,9 +1,12 @@
#!/bin/python
"""
-Make the organization of the mirror flat so that relative URLs cooperate
+Produces a flat_archive version of the archive without OSF category folders registration, profile, and project, so that relative URLs cooperate
+
archive/project/mst3k -> archive/mst3k
-:param 1 in CLI: folder to flatten
+WARNING: Utilities will not work with a flattened archive
+
+:param for CLI use: directory to flatten
"""
import os
import shutil
@@ -11,21 +14,35 @@
mirror = 'archive/' if len(sys.argv) < 2 else sys.argv[1] + '/'
-inflated_directories = ['project/', 'registration/']
-print("Flattening:", mirror)
+def make_wiki_flat(subdir):
+ wiki_home = subdir + '/wiki/home/index.html'
+ if os.path.exists(wiki_home):
+ shutil.copy(wiki_home, subdir + '/wiki/index.html')
+
+
+def remove_organization():
+ """
+ Removes category folders and calls make_wiki_flat
+ :return:
+ """
+ inflated_categories = ['project/', 'registration/', 'profile/']
+ for category in inflated_categories:
+ category_path = 'archive/' + category
-for directory in inflated_directories:
+ if not os.path.exists(category_path):
+ continue
- path = 'archive/' + directory
+ if os.path.exists(category_path + '/.DS_Store'):
+ os.remove(category_path + '/.DS_Store')
- if not os.path.exists(path):
- continue
+ subdirs = os.listdir(category_path)
+ for dir in subdirs:
+ make_wiki_flat(dir)
+ shutil.move(category_path + dir, 'archive/' + dir)
+ os.rmdir(category_path)
- if os.path.exists(path + '/.DS_Store'):
- os.remove(path + '/.DS_Store')
+if __name__ == "__main__":
+ print("Flattening:", mirror)
- subdirs = os.listdir(path)
- for dir in subdirs:
- shutil.move(path + dir, 'archive/' + dir)
- os.rmdir(path)
+ remove_organization()
\ No newline at end of file