forked from laurensorensen/DPDP_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestructureForCompliance
More file actions
executable file
·40 lines (37 loc) · 1.74 KB
/
restructureForCompliance
File metadata and controls
executable file
·40 lines (37 loc) · 1.74 KB
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
#!/bin/bash
# This file is part of Archivematica.
#
# Copyright 2010-2012 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Archivematica is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Archivematica. If not, see <http://www.gnu.org/licenses/>.
# @package Archivematica
# @subpackage Ingest
# @author Joseph Perry <joseph@artefactual.com>
# @version svn: $Id$
# Some edits by Dave Rice to skip migration of contents to /tmp and to handle if input is a file
target=$1
if [ -d "$target" ]; then
mkdir "${target}/objects"
mv $(find "$target" -mindepth 1 -maxdepth 1 ! -name "objects") "${target}/objects/"
mkdir "${target}/metadata"
mkdir "${target}/metadata/submissionDocumentation"
elif [ -f "$target" -a ! -d "$(dirname "$target")/$(basename "${target%.*}")" ]; then
mkdir -p "$(dirname "$target")/$(basename "${target%.*}")/objects" # okay, this line only works if the file actually has a period in the filename ... fix later
mv "$target" "$(dirname "$target")/$(basename "${target%.*}")/objects/"
mkdir "$(dirname "$target")/$(basename "${target%.*}")/metadata"
mkdir "$(dirname "$target")/$(basename "${target%.*}")/metadata/submissionDocumentation"
else
echo Error: Needs SIP directory as argument 1>&2
exit 1
fi