shithub: rc

Download patch

ref: 12517607a5db367cf9a15474f1424759cef1683a
parent: d7a1ee80efc0872f929961f487ca6ab30e97d87d
author: qwx <qwx@sciops.net>
date: Sat Nov 14 07:48:00 EST 2020

syncab: add option to sort of ignore mtimes

necessary for stupid media which stupidly screws them up

--- a/syncab
+++ b/syncab
@@ -1,7 +1,12 @@
 #!/bin/rc
 rfork n
+nomtime=0
+if(~ $1 -m){
+	nomtime=1
+	shift
+}
 if(! ~ $#* 2){
-	echo usage: $0 left right
+	echo usage: $0 [-m] left right
 	exit usage
 }
 
@@ -12,14 +17,17 @@
 	-F'	' \
 	-v 'ref='^$ref \
 	-v 'old='^$old \
+	-v 'nomtime='^$nomtime \
 '
 BEGIN{
 	rm["na"] = rm["dn"] = rm["dm!"] = 1
+	if(nomtime)
+		nocp["nm"] = 1
 }
 {
 	if($1 in rm)
 		ls["rm"] = "''" old "/" $2 "'' " ls["rm"]
-	else
+	else if(! ($1 in nocp))
 		ls["cp"] = ls["cp"] " " "''" $2 "''"
 	cnt[$1]++
 }