The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-21-2007
mohan705 mohan705 is offline
Registered User
 

Join Date: Feb 2007
Posts: 115
copy files from one dir to another

Hi ,
I want to copy files from one dir to anothe dir and check if destination dir exists ,if not exist ,has to create but when executing the below schell script ,the destination directory not exist and exit the shell script.
#!/bin/sh
src_path=/home/owngdw/abc
tgt_path=/home/owngdw/abc/xyz
if [ ! -d ${tgt_path}];
then
mkdir -p ${tgt_path}
#mkdir -p abc/xyz
fi
cp ${src_path}/aaa* ${tgt_path}/

Thanks
MR
Reply With Quote
Remove advertisements
!!
Forum Sponsor