Skip to content
Snippets Groups Projects
Commit a8333786 authored by Ruben's avatar Ruben
Browse files

json file is copied outside of the target folder+somechanges in README and help

parent 0d5e6914
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,7 @@ format <username>_YYYYMMDDThhmmss_<targetfoldername> and the
following extensions:
.log - with the outputs of the script.
.json - copy of the ARCHIVE_METADATA.json file.
.manifest - with the full list of archived files including
permissions, ownership, size, date, and path.
.md5sum - with the full list of archived files and their
......@@ -75,14 +76,11 @@ inside of the target directory and, therefore, included in
the .tar.bz2 file.
After the creation of these files, cjarchiver renames the
target directory as <targetdirectory>.toberemoved/ and
automatically moves the .tar.bz2 file to the default archiving
directory: /scicore/archive/<group>/<username>/
target directory as <targetdirectory>.toberemoved/
As its name indicates, <targetdirectory>.toberemoved/ can be
deleted, but prior to that, we strongly recommend to check that
the .tar.bz2 file has been correctly moved to the archiving
directory.
the .tar.bz2 file has been created.
-----------------------------------------------------------
......
......@@ -60,7 +60,7 @@ def checkdirectory(directory,out):
logfile.flush()
#Checks if metadata exists and has the correct JSON format
def checkmetadata(directory):
def checkmetadata(directory,namejson):
pathfile=os.environ['PWD']+'/'+directory+'/ARCHIVE_METADATA.json'
exists=os.path.isfile(pathfile)
print "Searching metadata %s" %(pathfile)
......@@ -72,6 +72,9 @@ def checkmetadata(directory):
if correct:
print "Metadata format is correct"
logfile.write("Metadata format is correct\n")
os.system('cp '+pathfile+' ./'+namejson)
logfile.write("json file copied\n")
logfile.flush()
else:
print "Metadata format is NOT correct. Use -h or --help for an example of JSON format"
logfile.write("Metadata format is NOT correct\n")
......@@ -191,9 +194,6 @@ cjarchive.py archives a folder and all its contents in a compressed file
with the name USER_YYYYMMDDHHMMSS_DIRECTORY.tar.bz2. Requires that the
target folder contains a metadata file named ARCHIVE_METADATA.json in
JSON format (see below an example).
After the archive has been created it is moved to
/scicore/archive/<group>/<user>/
Developed by Ruben M. Cabezon - sciCORE (University of Basel)
ruben.cabezon@unibas.ch
......@@ -245,6 +245,7 @@ namelog=name+'.log'
namemd5=name+'.md5sum'
nameman=name+'.manifest'
archivefile=name+'.tar.bz2'
namejson=name+'.json'
#*************************************************************
#Open logfile
......@@ -256,7 +257,7 @@ logfile=open(namelog,'a')
#Main code
#*************************************************************
checkdirectory(directory,0)
checkmetadata(directory)
checkmetadata(directory,namejson)
if args.exclude:
for f in excluded:
checkdirectory(directory+'/'+f,1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment