linux - disk space limitation when creating war file -
i have 1 gb disk space limitation hosting app , have used 700mb of it.
however want create war file directory big (around 600mb) using command :
jar -cvf root.war folderpath
that's why encounter quota limitation , can't following.
i'm looking way delete folder content when it's applying archive conserve disk space
take note can't install zip tool in ssh shell ~
the code works on test directories, test first anyway, deletes files. it's not efficient.
assumptions: 300mb free space, in destructively compress 600mb folderpath directory. none of files big -- if file in folderpath 300mb or larger, fail.
notes: if '$out' file exists, nothing. first find
pipes file list while
, if '$out' doesn't exist in loop, create it, don't update -- if does exist, update it. each pass adds 1 more file, deletes unless file directory. after loop finishes delete empty directories too.
unset u ; in=folderpath ; out=root.war ; \ [ -f $out ] || ( find $in | \ while read ; \ [ -f $out ] && u=u ; \ jar -cvf$u $out "$a" || { echo "fail, stopping..." ; exit 1 ; } \ rm -d "$a" 2> /dev/null ; \ done ; rm -rd $in ; )
Comments
Post a Comment