Commits

lan Nomar committed fb3c6a0

net/ftpcp: dev

Comments (0)

Files changed (1)

 #!/bin/brc
 	
-echo remember that there is a difference between lcd and cd!
 { . $HOME/.config/brc/modules/std }
 
-
 #contains (
 # nl 
 user = nmz
 url = ( ftp://$user:$pass@$host/$rootpath/ )
 
 fn goback { # echoes cd ../../../
-	echo goback $*
 	echo -n cd "
 	for ( * in `{ seq 0 $* } ) {
 		echo -n ../
 }
 
   # some vars that should exist at start time
-	shift = `` (/) { echo $PWD }
-
+	pwd = `` (/) { echo -n $PWD }
+	ld = IGNORE
+	
 for (* in `` $nl { find $PWD -type d } ) {
   # Full directory
 	FD = $*
 	fd	= `` (/) { echo -n $* }
 	
   # Current directory
-	fd = $fd { vshift fd $shift
+	fd = $fd { vshift fd $#pwd
 		cd = $fd }
-	cd = $cd { vflat cd /
-		CD = $cd }
+		
 	
+if (!~ $ld IGNORE){
   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 lcd "$^FD^"
 	
 	# test all files, change type -- use function
-#	echo mput '*' $^nl^a
+	echo mput '*' $^nl^a
 	
 	ld = $cd
 }