mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	added abulity to copy multiple flash cards into a single root dir (see: -multi and -last flags)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									0c9ba92964
								
							
						
					
					
						commit
						6a19bc56d9
					
				| @ -4,23 +4,62 @@ DATE=`date +%Y%m%d` | |||||||
| COUNT=1 | COUNT=1 | ||||||
| TITLE="" | TITLE="" | ||||||
| 
 | 
 | ||||||
| if ! [ -z $2 ] ; then | while true ; do | ||||||
|  | 	case "$1" in | ||||||
|  | 		-h|-help|--help) | ||||||
|  | 			echo "usage: `basename $0` FLAGS DRIVE [TITLE]" | ||||||
|  | 			echo | ||||||
|  | 			echo "	-h|-help	print this message and exit." | ||||||
|  | 			echo "	-m|-multi	single base, multiple sub dirs" | ||||||
|  | 			echo "			for multiple flash cards in a" | ||||||
|  | 			echo "			single shoot." | ||||||
|  | 			echo "	-l|-last	last flash card in set, run" | ||||||
|  | 			echo "			process-archive.sh after copying." | ||||||
|  | 			echo | ||||||
|  | 			exit | ||||||
|  | 			;; | ||||||
|  | 		-m|-multi|--multi) | ||||||
|  | 			MULTI=1 | ||||||
|  | 			shift | ||||||
|  | 			;; | ||||||
|  | 		-l|-last|--last) | ||||||
|  | 			LAST=1 | ||||||
|  | 			COMMON_FLAG=-c | ||||||
|  | 			shift | ||||||
|  | 			;; | ||||||
|  | 		*) | ||||||
|  | 			break | ||||||
|  | 			;; | ||||||
|  | 	esac | ||||||
|  | done | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | if ! [ -z "$2" ] ; then | ||||||
| 	TITLE=" - $2" | 	TITLE=" - $2" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # XXX do a real three digit count... | # XXX do a real three digit count... | ||||||
| DIR="./- ${DATE}.00${COUNT}${TITLE}/" | # single flash card... | ||||||
| 
 | if [ -z $MULTI ] ; then | ||||||
| while [ -e "$DIR" ] ; do |  | ||||||
| 	COUNT=$((COUNT+1)) |  | ||||||
| 	DIR="./- ${DATE}.00${COUNT}${TITLE}/" | 	DIR="./- ${DATE}.00${COUNT}${TITLE}/" | ||||||
| done | 	while [ -e "$DIR" ] ; do | ||||||
|  | 		COUNT=$((COUNT+1)) | ||||||
|  | 		DIR="./- ${DATE}.00${COUNT}${TITLE}/" | ||||||
|  | 	done | ||||||
|  | 	BASE_DIR=$DIR | ||||||
|  | 
 | ||||||
|  | # multiple flash cards shoot... | ||||||
|  | else | ||||||
|  | 	BASE_DIR="./- ${DATE}${TITLE}/" | ||||||
|  | 	DIR="${BASE_DIR}/${DATE}.00${COUNT}/" | ||||||
|  | 	while [ -e "$DIR" ] ; do | ||||||
|  | 		COUNT=$((COUNT+1)) | ||||||
|  | 		DIR="${BASE_DIR}/${DATE}.00${COUNT}/" | ||||||
|  | 	done | ||||||
|  | fi | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| echo "Creating directory: $DIR" | mkdir -vp "$DIR" | ||||||
| mkdir "$DIR" |  | ||||||
| echo "Creating directory: done." |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| echo "Copying files from $1..." | echo "Copying files from $1..." | ||||||
| @ -28,7 +67,8 @@ cp -Rpfv /mnt/${1}/* "$DIR" | |||||||
| echo "Copying files: done." | echo "Copying files: done." | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | if [[ ! $MULTI || $LAST ]] ; then | ||||||
| echo "Building archive..." | 	echo "Building archive..." | ||||||
| ./process-archive.sh "$DIR" | 	./process-archive.sh $COMMON_FLAG "$BASE_DIR" | ||||||
| echo "Building archive: done." | 	echo "Building archive: done." | ||||||
|  | fi | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user