#!/bin/bash
#
#-------------------------------------------------------------------------------
# %PS
#
# Licensed Inte#
#-------------------------------------------------------------------------------
# %PS
#
# Licensed Internal Code - Property of IBM
#
# 2105/2107 Licensed Internal Code
#
# (C) Copyright IBM Corp. 2004 All Rights Reserved.
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
# %EPS
#-------------------------------------------------------------------------------
#Change History:
#
# Modifier			Date				Change ID
#----------------------------------------------------------------------------------
# Shaul Pinkerfeld		August 5, 2004                 106623   		
# Initial creation.
# Shaul Pinkerfeld		August 18, 2004                106576   		
# change to bash.
#-------------------------------------------------------------------------------




#-------------------------------------------------------------------------------
# Copied all the files thier name are <logs_files_base_name> with ".[0-9]" extension
# to the destination_directory.
# Parameter logs_files_fullpath_name - the full path name of the files to copied.(not included the suffix)
# Parameter destination_directory - the destination directory.
# Return: 0 on success ; 1 - if error in wrong usage the script.
#-------------------------------------------------------------------------------

 
[[ $# -ne 2 ]] &&
{
    echo "Error number of parameters"
    echo "Usage:"
    echo "$(basename ${0}): <logs_files_fullpath_name>   <destination_directory>"
    exit 1 ;
}
files=$(ls ${1}.* | egrep "\.[0-9]*$")
for i in ${files}
do
    cp ${i} ${2}
    echo "${2}/$(basename ${i})"
done
