Copy all HTML files to a folder called webback.

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*/

I wonder if Homa would be mad if she knew u were cheating

Btw i did it in 6 lines

She will be extremely happy ..!:slight_smile:

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.