-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
28 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
__pycache__ | ||
|
||
archive_creator.py | ||
archives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import zipfile | ||
import os | ||
|
||
# Directories and file paths | ||
root_dir = os.path.dirname(os.path.abspath(__file__)) | ||
archives_dir = os.path.join(root_dir, 'archives') | ||
|
||
# Ensure the archives directory exists | ||
os.makedirs(archives_dir, exist_ok=True) | ||
|
||
# List of all files in the root directory | ||
all_files = [ | ||
f for f in os.listdir(root_dir) | ||
if os.path.isfile(os.path.join(root_dir, f)) | ||
] | ||
|
||
# Archive file specifications | ||
archive_specs = { | ||
'bat.zip': [f for f in all_files if f not in ['.gitignore', 'search.sh']], | ||
'bash.zip': [f for f in all_files if f not in ['.gitignore', 'search.bat']], | ||
'scoop.zip': [f for f in all_files if f not in ['.gitignore', 'search.bat', 'search.sh']] | ||
} | ||
|
||
# Create archives based on the specifications | ||
for archive_name, files_to_include in archive_specs.items(): | ||
archive_path = os.path.join(archives_dir, archive_name) | ||
with zipfile.ZipFile(archive_path, 'w', zipfile.ZIP_DEFLATED) as archive: | ||
for file in files_to_include: | ||
archive.write(os.path.join(root_dir, file), file) | ||
|
||
print("Archives created successfully!") |