diff --git a/README b/README index e99b032e89f309956e335d68983443d707e2eb52..c01aae3f26934d7d7c6f8acbaa91829c6eb24185 100644 --- a/README +++ b/README @@ -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. ----------------------------------------------------------- diff --git a/bin/cjarchiver b/bin/cjarchiver index ed6f23d7ece367e5f11378f803023bcbe0e8ba53..481c39c8b29c6a0d272f8a77c9488245290cc90d 100755 --- a/bin/cjarchiver +++ b/bin/cjarchiver @@ -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)