Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
blackboard-extractor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
blackboard-extractor
Commits
a3f71be1
Commit
a3f71be1
authored
Sep 12, 2015
by
Richard Torenvliet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Find more files to extract
parent
70d19c7c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
19 deletions
+26
-19
bb_extract
bb_extract
+26
-19
No files found.
bb_extract
View file @
a3f71be1
...
@@ -37,21 +37,25 @@ REV=`tput smso`
...
@@ -37,21 +37,25 @@ REV=`tput smso`
function extract() {
function extract() {
ARCHIVE=$1
ARCHIVE=$1
OUTPUT=$2
OUTPUT=$2
result="success"
if [ -f $ARCHIVE ] ; then
if [ -f $ARCHIVE ] ; then
case $ARCHIVE in
case $ARCHIVE in
*.bz2) tar xvjf $ARCHIVE -C $OUTPUT;;
*.tbz) tar xjf $ARCHIVE -C $OUTPUT;;
*.gz) tar xvzf $ARCHIVE -C $OUTPUT;;
*.bz2) tar xjf $ARCHIVE -C $OUTPUT;;
*.tgz) tar xvzf $ARCHIVE -C $OUTPUT;;
*.gz) tar xzf $ARCHIVE -C $OUTPUT;;
*.tbz2) tar xvjf $ARCHIVE -C $OUTPUT;;
*.tgz) tar xzf $ARCHIVE -C $OUTPUT;;
*.tbz2) tar xjf $ARCHIVE -C $OUTPUT;;
*.rar) unrar x $ARCHIVE $OUTPUT;;
*.rar) unrar x $ARCHIVE $OUTPUT;;
*.tar) tar x
v
f $ARCHIVE -C $OUTPUT;;
*.tar) tar xf $ARCHIVE -C $OUTPUT;;
*.zip) unzip $ARCHIVE
-d $OUTPUT
;;
*.zip) unzip $ARCHIVE
-d $OUTPUT 1> /dev/null
;;
*)
echo "'$ARCHIVE' cannot be extracted via >extract<
"
*)
$result="fail
"
esac
esac
else
else
echo "'$ARCHIVE' is not a valid file $OUTPUT, continueing
"
$result="file_not_found
"
fi
fi
echo $result
}
}
# forloop delimiter
# forloop delimiter
...
@@ -78,18 +82,17 @@ function find_and_unpack() {
...
@@ -78,18 +82,17 @@ function find_and_unpack() {
cp $i $SUBMIT_NAME
cp $i $SUBMIT_NAME
FIND_PREFIX=`basename $PREFIX`
FIND_PREFIX=`basename $PREFIX`
ARCHIVE_LIST=`find $INPUT_DIR -name "$FIND_PREFIX\_*.
tar.
gz" \
ARCHIVE_LIST=`find $INPUT_DIR -name "$FIND_PREFIX\_*.gz" \
-o -name "$FIND_PREFIX\_*.tar"\
-o -name "$FIND_PREFIX\_*.tar"\
-o -name "$FIND_PREFIX\_*.zip"\
-o -name "$FIND_PREFIX\_*.zip"\
-o -name "$FIND_PREFIX\_*.rar"\
-o -name "$FIND_PREFIX\_*.rar"\
-o -name "$FIND_PREFIX\_*.tgz"\
-o -name "$FIND_PREFIX\_*.[bz2tg]*"`
-o -name "$FIND_PREFIX\_*.tar.bz2"`
PDF_LIST=`find "$INPUT_DIR" -name "$FIND_PREFIX\_*.pdf" -print0
`
FILE_LIST=`find "$INPUT_DIR" -name "$FIND_PREFIX\_*.[A-Za-z0-9]*"
`
for PDF in $PDF_LIST; do
for FILE in $FILE_LIST; do
cp $PDF_LIST $SUBMIT_NAME
echo $FILE
cp $FILE_LIST $SUBMIT_NAME
done
done
if [ -z $ARCHIVE_LIST ]; then echo $SUBMIT_NAME >> "error.txt"
if [ -z $ARCHIVE_LIST ]; then echo $SUBMIT_NAME >> "error.txt"
...
@@ -158,10 +161,14 @@ while [ $# -ne 0 ]; do
...
@@ -158,10 +161,14 @@ while [ $# -ne 0 ]; do
create_directory $OUTPUT_DIR
create_directory $OUTPUT_DIR
echo "extracting $ZIPFILE to $BB_EXTRACT_DIR"
echo "extracting $ZIPFILE to $BB_EXTRACT_DIR"
extract $ZIPFILE $BB_EXTRACT_DIR
result=$(extract $ZIPFILE $BB_EXTRACT_DIR)
if [ $result != "fail" ]; then
echo "find and unpack all submitted assignments"
echo "find and unpack all submitted assignments"
find_and_unpack $BB_EXTRACT_DIR $OUTPUT_DIR
find_and_unpack $BB_EXTRACT_DIR $OUTPUT_DIR
else
echo "continueing"
fi
shift
shift
done
done
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment