lan Nomar avatar lan Nomar committed abd1997

net/ftpcp: copies a directory via ftp

Comments (0)

Files changed (2)

+#!/bin/brc
+	
+echo remember that there is a difference between lcd and cd!
+{ . $HOME/.config/brc/modules/std }
+
+
+#contains (
+# nl 
+user = nmz
+pass = DancingMad
+host = 10.0.0.66
+
+rootpath = Music
+
+url = ( ftp://$user:$pass@$host/$rootpath/ )
+
+fn goback { # echoes cd ../../../
+	echo goback $*
+	echo -n cd "
+	for ( * in `{ seq 0 $* } ) {
+		echo -n ../
+	}
+	echo "
+}
+
+  # some vars that should exist at start time
+	shift = `` (/) { echo $PWD }
+
+for (* in `` $nl { find $PWD -type d } ) {
+  # Full directory
+	FD = $*
+	fd	= `` (/) { echo -n $* }
+	
+  # Current directory
+	fd = $fd { vshift fd $shift
+		cd = $fd }
+	cd = $cd { vflat cd /
+		CD = $cd }
+	
+  if ( ~ $#cd $#ld ) {	# stay in current directory
+		echo cd ../
+  } else {
+	if ( expr $#cd '<' $#ld > /dev/null ){
+		* = `{ expr $#ld '-' $#cd }
+		goback $*
+  }	}
+	
+  # code starts
+	echo mkdir "$fd($#fd)^"
+	echo cd "$fd($#fd)^" 
+	echo lcd "$^FD^"
+	
+	# test all files, change type -- use function
+#	echo mput '*' $^nl^a
+	
+	ld = $cd
+}
 #!/usr/bin/env brc
 
+#	unify commands to functions
+#	a command that 
+#	remove links function
+		
 nl='
 '
 
 Tfile=/tmp/keeplinks
 
 
+#fn Support	{
+#	quviDir = /usr/local/share/libquvi-scripts/lua/website
+#		cd $quviDir
+#	*=$* ifs=. {	#( ls *.lua | sed s/.lua//g )#
+#	  for ( * in *.lua ) {
+#		* = `{ echo -n $* }
+#		sites = ( $sites $1 ) 
+#}	}	}	}
+
+*=$* {
+  for ( * in `` ($nl) { cclive --support | tr -d '%' } ) {
+	* = `{ echo $1 }
+	* = `{ echo $1 }
+	* = `` '|' { echo -n $* }
+	sites = ( $sites $* ) 
+} }
+
+
+fn readitlater {
+	file = $HOME^'/.mozilla/firefox/hd2vm0qe.default/readItLater.sqlite'
+
+  for ( * in `` ($nl) { sqlite3 $^file '.dump items' } ) {
+	ifs = , {
+		* = `{ echo -n $* | tr -d '''' }
+		if (~ $3 *$sites/* *$sites/* ){
+			link	= ( $link	$3 )
+		  	title	= ( $title	$4 )
+  } }	}
+  
+  *=()
+	for ( title in $title ){
+		* = ($* 1)
+		echo $title $^nl '	' $link($#*)
+}	}
+
+
+# File
+~ $#* 0	&& readitlater || $^*
+
+
+cclive --output-dir $HOME/Hideo/misc/ $link
+
+
+
+
 fn oldcode {
 for (line in `` ($nl) {cat $file}){
 	if (~ $line *^'youtube.com/watch?'^* *^youtu.be/^*){
 while (!~ $#seq 20){
 	seq=($seq 1)
 	echo >> $file
-}
-}
-
-#grep -v $1 -v $2 -v $3 -v $4 -v $5 
+}	}
 
 fn old { 
-awk '{
+  awk '{
 	if ( /youtu?be*/ )
 		system ("cclive --progressbar simple --output-dir '^$^HOME^/Hideo/^' "$0)
 	else
 		print $0
-}' $file > /tmp/links
+  }' $file > /tmp/links
 
-#( Temporal File )#
+  #( Temporal File )#
 	cat /tmp/links > $file
 	rm /tmp/links
 }
 		rm $Tfile
 }
 }
-
-fn readitlater {
-file = $HOME^'/.mozilla/firefox/hd2vm0qe.default/readItLater.sqlite'
-
-ifs=$nl { list = `{ sqlite3 $^file '.dump items' | awk -F'''' '/youtube.com/ { print $2 }' } }
-
-}
-
-if (~ $#* 0 ) {
-	readitlater
-
-	} else {	$^*
-}
-		
-cd $HOME/Hideo/misc/
-
-for (* in $list) { echo $* }
-cclive $list
-
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.