LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   cpio and directories (https://www.linuxquestions.org/questions/general-10/cpio-and-directories-471354/)

consty 08-06-2006 02:57 PM

cpio and directories
 
Hi,
I have to backup directories trees and subdirectories on disk while maintaining owners, links and date. I would like to use cpio but the only problem is that the "m" option does'nt work when copying directories. Had anyone faced and solved that problem ?
Thanks for help

MensaWater 08-12-2006 12:16 PM

Are you using find - if so you need to include the -depth option of find so it acts on the directories before the files in them.

The standard command line I've been using for years to make cpio archives (or backups to tape):

find . -depth |cpio -ovBc >file.cpio

Of course . could be substituted with a specific directory if you want the full path in the archive. The "file" I usually put in as the directory backed up so I'll know when I look at it later.

e.g.
find /var/named |cpio -ovBc >var_name.cpio

To read in such archives I always did:
cpio -ivBcumd <file.cpio

You could always try rsync instead if you're doing disk to disk copying.


All times are GMT -5. The time now is 05:20 AM.