Welcome, Guest
Username Password: Remember me

find c file recursivly and copy to directory
(1 viewing) (1) Guest
Shell Script
  • Page:
  • 1

TOPIC: find c file recursivly and copy to directory

find c file recursivly and copy to directory 1 year, 4 months ago #505

  • scmuser
  • OFFLINE
  • Gold Boarder
  • scm master
  • Posts: 237
  • Points: 3429
  • Karma: 0
  • Honor Medal 2009
Write a shell script to find c file recursivly and copy to one common directory?

Re: find c file recursivly and copy to directory 1 year, 4 months ago #506

  • rajeshkumar
  • OFFLINE
  • Moderator
  • I love software configuration management
  • Posts: 370
  • Points: 44589
  • Karma: 4
  • Honor Medal 2009
following program will serve your purpose...


#!/bin/sh
counter=0
if [ $# -eq 0 ]
then

for file in `find ./os -name "*.c"`
do
cp $file /root/Release/Rajesh
echo $file
counter=`expr $counter + 1`
done
else
echo "No Argument passed"
fi

echo "Number of files found=$counter"
Regards,
Rajesh Kumar
Build and Release Engineer
My Blog: community.scmgalaxy.com/pg/profile/rajeshkumar
  • Page:
  • 1
Time to create page: 1.14 seconds

     
    
Home Forum