The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Transfer files wih directory structure. uxlunatick SCO 11 04-28-2008 12:25 PM
Recursion to Copy a Directory structure avrkiran Shell Programming and Scripting 2 03-30-2008 11:43 PM
MV files from one directory structure(multiple level) to other directory structure srmadab UNIX for Advanced & Expert Users 4 09-13-2006 01:01 PM
any idea to copy directory structure myelvis UNIX for Dummies Questions & Answers 6 11-18-2003 01:47 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-11-2006
Registered User
 

Join Date: Dec 2006
Posts: 3
copy files with directory structure

i have a text file as.


/database/sp/NTR_Update_Imsi_List.sql
/database/sp/NTR_Update_Imsi_Range_List.sql
/database/sp/NTR_Vlr_Upload.sql
/database/tables/StatsTables.sql
/mib/ntr.mib
/mib/ntr.v2.mib
/scripts/operations/ntr/IMSITracer.ph
/scripts/operations/ntr/IMSITracer.pl
/scripts/operations/ntr/NTIMSIRangeUpload.pl
/scripts/operations/ntr/NTRBatchUploadIMSI.pl

i want to copy all this files with their directory structures into home directory
plz help.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-11-2006
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
I found this tip in bash guide

Code:
( cd /dir1/dir2 && tar cf - . ) | ( cd / && tar xpvf - )
Reply With Quote
  #3 (permalink)  
Old 12-11-2006
Registered User
 

Join Date: Dec 2006
Posts: 3
Unhappy

name of my file is aadd.sh.
i useur command as

mkdir -p $1/$2
cat aadd.sh|( cd $1/$2 && tar cf - . ) | ( cd / && tar xpvf - )

were $1=ntt
n $2=rss

but its not working
Reply With Quote
  #4 (permalink)  
Old 12-11-2006
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
I didn't read your requirement properly.

Code:
while read pth
do
    dr=`dirname $pth`
    if [ -d "homedir/$dr" ]
    then
       mkdir -p "homedir/$dr"
    fi
    cp $pth "homedir/$dr"
done < aadd.sh
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:59 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0