copying files

hi
I want to copy all files from the current directory and move to .archive file.
Moreover,I want to add .bak to each file name, that will be copied.
How can I do that?

The script:

#! /usr/bin/bash

# check on existence of archive
if [ ! -d archive ]
   then
   mkdir archive
fi

# copy the files
for zf in file*
   do
   echo $zf
   cp $zf "./archive/"$zf".bak"
done

# see what is in the archive folder
ls -l ./archive

exit 0

The script will move any files that are called file* - meaning file1, file2, file3, etc... You could modify the file* to whatever is appropriate for your use.

Script exection will echo the found files and the resultant files in the archive folder. Both of these steps can be omitted - only included to help see what is happening.

You can do something like that :

for file in *
do
   cp ${file} .archive/${file}.bak
done

Jean-Pierre.

ls -1 * | while read file
do
cp "${file}" .archive/${file}.bak
done

thanks