-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathupdate-gh-pages.sh
More file actions
executable file
·30 lines (22 loc) · 985 Bytes
/
update-gh-pages.sh
File metadata and controls
executable file
·30 lines (22 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Script to update PDF files in gh-pages branch
# Create a temporary directory for PDFs
tmp_dir=$(mktemp -d)
echo "Created temporary directory: $tmp_dir"
# Move all PDF files (except publications/) to temporary directory while preserving directory structure
find . -name "*.pdf" -type f ! -path "./publications/*" | while read file; do
# Create target directory in tmp_dir
mkdir -p "$tmp_dir/$(dirname "$file")"
# Move file preserving path structure
mv "$file" "$tmp_dir/$file"
done
echo "Moved PDF files to temporary directory"
# Switch to gh-pages branch
git checkout gh-pages
echo "Switched to gh-pages branch"
# Copy all PDF files from temporary directory preserving structure
echo "Restoring PDF files from temporary directory"
echo "You may need to delete some old files manually if directory structure or filename has changed"
cp -r "$tmp_dir"/. .
echo "Restored PDF files from temporary directory"
echo "Now commit those PDF files yourself"