## Help indexing: make thumbnail of the first image of every jpg subdirectory of every dir
for (DIR in *) {
if (test -d $DIR) {
cd $DIR
if (! test -e +INDEX) {
if (test -d jpg) {
cd jpg
if (ls *.jpg > /dev/null) {
if (! test -e ../+INDEX*) {
name = `{ls *.jpg | sed 1q}
cat $name | jpg -39 | resample -x 800 > ../+INDEX.9img
}
}
cd ..
}
}
cd ..
}
}
## Help indexing ... j2k
for (DIR in `{ls -d [a-z]*} ) {
if (test -d $DIR) {
cd $DIR
if (test -d j2k) {
cd j2k
if (ls *.j2k > /dev/null) {
if (! test -e ../+INDEX*) {
name = `{ls *.j2k | sed 1q}
echo $name
j2kto9 $name | resample -x 800 > ../+INDEX.9img
}
}
cd ..
}
cd ..
}
}
## Report all j2k dirs created by JJ2000
THIS= `{pwd}
rm $THIS/log
for (DIR in *) {
if (test -d $DIR) {
cd $DIR
if (test -d j2k) {
cd j2k
if (ls *.j2k > /dev/null) {
name = `{ls *.j2k | sed 1q}
if (grep JJ2000 $name > /dev/null) pwd >> $THIS/log
}
cd ..
}
cd ..
}
}
## remove empty directories
for (DIR in *) {
if (test -d $DIR) {
if (! ls $DIR/* > /dev/null) rm $DIR
}
}
## count all PDF files in all subdirectories
walk . 'ls *.pdf ' |wc -l
#or
find2 /n/a *.pdf | wc -l
## Report all PDF files in all subdirectories
find2 /n/a *.pdf
## Report missing +INDEX files
THIS= `{pwd}
date >> $THIS/+TODO
for (i in `{cat foo} )
if (! test -e $i/../+INDEX) echo $i >> $THIS/+TODO
## Report missing +INDEX files
THIS= `{pwd}
date >> $THIS/+TODO
for (i in *)
if (! test -e $i/+INDEX) echo $i >> $THIS/+TODO
## Cat all +INDEX files in all subdirectories
rm $home/bigindex
walk . 'echo `{pwd} >> $home/bigindex; cat +INDEX >> $home/bigindex'
## Compare # of files in subdirs 'j2k' and 'NAME'
NAME=jpg
THIS= `{pwd}
for (DIR in *) {
if (test -d $DIR && test -d $NAME) {
cd $DIR
if (! cmp <{ls j2k | wc -l} < {ls $NAME | wc -l}) echo NOT MATCHING; pwd
cd ..
}
cd $THIS
}
## df
con /srv/fscons
fsys main
df
#fsck
con /srv/fscons
fsys main
check fix
## root
con /srv/fscons
fsys main
uname sys +pac
uname sys -pac
## Report missing j2k subdirs
echo === Report missing j2k subdirs ==== >> $home/log
echo `{pwd} >> $home/log
for (i in *)
if (! test -d $i/j2k) echo $i >>[1] $home/log >[2] /dev/null
## Count files in subdirs
echo === Count files in subdirs ==== >> $home/log
date >> $home/log
echo `{pwd} >> $home/log
for (DIR in *) {
if (test -d $DIR) {
cd $DIR; echo $DIR >> $home/log
for (TYPE in jpg j2k) {
echo $TYPE >> $home/log
ls $TYPE/*.^$TYPE | wc -l >>[1] $home/log >[2] /dev/null
}
cd ..
}
}
## Report corrupt j2k images
echo '=== Report corrupt j2k images ===' >> $home/log
echo `{pwd} >> $home/log
for (DIR in *) {
if (test -d $DIR) {
cd $DIR; echo $DIR >> $home/log
if (test -d j2k) {
cd j2k
for (i in *.j2k) {
# if (! j2kto9 $i >[1] /dev/null >[2] /dev/null) echo $i >> $home/log
if (! j2kto9 $i >[1] /dev/null) echo $i >> $home/log
}
cd ..
}
cd ..
}
}
## Help indexing ... j2k...add first j2k to tar
mkdir $home/tmp/j2ks
rm $home/tmp/j2ks/*
for (DIR in *) {
if (test -d $DIR) {
cd $DIR
if (test -d j2k) {
cd j2k
if (ls *.j2k > /dev/null) {
name = `{ls *.j2k | sed 1q}
cp $name $home/tmp/j2ks/^$DIR^.j2k
}
cd ..
}
cd ..
}
}
## Rm unwanted dirs from ... j2k nested in categories
for (j in *) {
if (test -d $j) {
cd $j
for (DIR in *) {
if (test -d $DIR) {
cd $DIR
if (test -d jpg) {
rm -fr jpg
}
cd ..
}
}
cd ..
}
}
## mount another fossil disk
man 4 fossil
## mount SAMBA network disk
aux/cifs vavr.gli.cas.cz
aux/cifs -m /n/vavr.gli.cas.cz 147.231.139.60
ls /n/vavr.gli.cas.cz
aux/cifs Geopicture.gli.cas.cz
aux/cifs -m /n/Geopicture.gli.cas.cz 147.231.139.67
ls '/n/Geopicture.gli.cas.cz/moje data/cej'
aux/cifs -m /n/cluster Cluster.asuch.cas.cz
ls /n/cluster/geohome/cej
#last touched file in a tree
walk DIR 'ls -lt | sed 1q' | awk ' /Sep/' | sort +6 | tail -n 3
:; |sed 's/www\.sciencedirect\.com/198.81.200.2/g'
:; |sed 's/www\.jstor\.org/204.153.51.29/g'
dircp without rewriting existing files
@{cd fromdir && tar cp .} | @{cd todir && tar xkT}
#print files from N1 to N2
ls * | awk 'NR>=N1 && NR<=N2 { print($0 " \\")}'
|