Copy a certain file from a CPIO file to a different directory

backup, cpio, restore, terminal, ubuntu

Solution

One way to do it would be to extract that single file to `stdout` and redirect it to the file of your choice:

cpio -i --to-stdout sub1/sub2/example.php < backup.cpio > new_filename.php

Problem

I am trying to copy a single file from a .cpio file, to a different directory rather than the tree inside it. I am trully sure it is possible, my teacher did it. I have tried this: ``` # cpio -i -F backup.cpio sub1/sub2/example.php ``` But that doesn't extract the file example where I want it to be extracted. I tried adding a third parameter but it doesn't work. Any suggestions? Oh, and I'm running Ubuntu.

Original source