如何从文件夹及其子文件夹下提取文件(csh脚本)

来源:百度知道 编辑:UC知道 时间:2024/07/01 00:55:05
ubuntu下,在某个文件夹及其子文件夹下查找特定的文件,如安文件名,然后对查找到的文件,进行一定处理,如解压缩,拷贝等操作。要求
csh tcsh,脚本。

高分悬赏,在线等

#!/bin/tcsh -f
if( -e rinex)then
echo "file have been changed"
exit
else
echo "please wait for moment"
mkdir rinex
set new_path="./rinex/"
find . > filename1.txt
@ count=1
@ dount=1
while( -s filename$count.txt)
set row=`sed -n 1p filename$count.txt`
@ len=`expr length $row`
set last_letter=`expr substr $row $len 1`
if($last_letter == "Z")then
@ dount=$count
@ count=$count + 1
cp $row $new_path
@ len=$len - 13
set dfile=`expr substr $row $len 12`
gunzip $new_path$dfile.Z
crx2rnx $new_path$dfile
rm $new_path$dfile
sed -e '1d' filename$dount.txt > filename$count.txt
rm -f filename$dount.txt
else
@ dount=$count
@ count=$count + 1
sed -e '1d' filename$dount.txt > filename$count.txt
rm -f filename$