Hi I need help in that script, in which I am trying to copy all HTML files in a folder called WEBBACK, display names of the files copied and a message.
Here is the script:
#!/bin/csh
set temp=`find *.html` \*TO FIND ALL THE HTML FILES*/
set n=$#temp \*N= NUMBER OF FILES*/
set a=1 \*COUNTER*/
set directory="webback"
set checkdir=`find webback` \*CHECKING IF WEBBACK EXISTS*/
if [ $checkdir[1] == $directory]then \*IF WEBBACK EXISTS THEN*/
while[$a <= $n]
cp $temp[$a] $directory/ \*MOVE FILE TO WEBBACK*/
echo $temp[$a] \*PRINTING NAME OF THE FILE MOVED*/
set a=`expr $a + 1` \*COUNTER INCREMENT*/
endif
if [ $checkdir[1] != $directory]then
mkdir $directory
while[$a <= $n]
cp $temp[$a] $directory/
echo $temp[$a]
set a=`expr $a + 1`
endif
echo "Above $n file/s have copied to $directory." \*MESSAGE*/