简体   繁体   中英

How to create cpio archive with custom structure

I have cpio archive with one file - /./folder1/file1

My goal is to replace file1 with another one.

I unpacked my cpio archive to folder /test and replaced file1 .

My structure:

/test/folder1/file1

I created new archive with this command:

find ./test | cpio -o -F newArch

But in newArch my files is stored as /folder1/file1 .

How can I get archive with structure /./folder1/file1

cpio doesn't have any prefix commands and although I still think it is a moot exercise, you can try if it preserves the filenames it gets via standard input:

find ./test -printf "././%f\n"| cpio -o -F newArch

Adjust the prefix of the format string as necessary. I don't have 7zip to test how it interprets the paths.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM