-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract_files.sh
55 lines (34 loc) · 1.01 KB
/
extract_files.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
#version 0.1
# this script renames a file with respect to the name of the student who
# submitted that file and then copies it under a directory to compare it
# with other students' code for similarity check.
# plagiarism check is made by moss tool.
DEBUG=0
# test unnecessarily
if [ -d ./plagiarism_check ] ; then
echo "info: directory exists, overwriting the directory"
rm -rf plagiarism_check
else
echo "info: directory does not exist, creating a new one"
fi
# change the directory
if [ -d ./grading ] ; then
mkdir plagiarism_check # create the directory
cd grading
else
echo "error: cannot find the directory 'grading' "
exit $?
fi
SUBMISSIONS=./*
FILENAME=ipr.cpp
# traverse the directory
for s in $SUBMISSIONS
do
DIRNAME=`dirname $s/$FILENAME`
EXTDIRNAME=${DIRNAME#./}
if [ $DEBUG -eq 1 ]; then
echo $EXTDIRNAME
fi
cp $s/$FILENAME ../plagiarism_check/$EXTDIRNAME.cpp
done