![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| combining mv and compress command | sam_78_nyc | Shell Programming and Scripting | 4 | 11-06-2007 11:45 AM |
| Compress command | indira | UNIX for Dummies Questions & Answers | 5 | 08-20-2007 11:04 AM |
| Copy and compress | here2learn | UNIX for Dummies Questions & Answers | 4 | 11-30-2005 05:29 AM |
| Compress and copy a Folder | scorpiyanz | UNIX for Advanced & Expert Users | 1 | 08-19-2005 10:53 AM |
| Help on compress command | rahulrathod | SCO | 1 | 09-28-2004 01:11 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Copy Compress as one command
Hi,
I need to copy and compress files in a directory in single line of command. I am able to copy and gzip files in one command but not directory. Command that I am using for copying directory is below : cp -rp /u01/app/<directory> /u01/app/backup |gzip -r /u01/app/backup/<directory> Thanks, Prakash |
| Forum Sponsor | ||
|
|
|
|||
|
I used below code as suggested by Porter for compressing and copying directory.
find ${COPY_DIR} -type f | while read N do mkdir -p "${BACKUP_DIR}/`dirname $N`" gzip < $N > ${BACKUP_DIR}/$N.gz done However I have some directories which have space in name. I get below error when copying and compressing directories which have sapce in name. /backup/sidora/iAS/ifs1.1/doc/Quick Tour/Graphics/rtarr.gif.gz: cannot create Any ideas on how can I take fix above error. Thanks in advance. |
|
|||
|
Thanks for update matrixmadhan. Even though after making suggsted changes I still get same error message. Now my code looks like :
find ${COPY_DIR} -type f | while read N do mkdir -p "${BACKUP_DIR}/`dirname $N`" gzip < "$N" > "${BACKUP_DIR}/$N.gz" done Error message /backup/sidora/iAS/ifs1.1/doc/Quick Tour/Graphics/rtarr.gif.gz: cannot create |