I recently found out about the existence of cpio and how it can be used, among many other things, to extract individual files from an rpm in conjunction with the rpm2cpio tool, like this:
rpm2cpio mypackage.rpm | cpio -idmv ./path/to/individual/file/inside/the/rpm/filename.txt
The problem is that this command will create the directory that matches the file's location inside the rpm, i.e., it will create the directory /path/to/individual/file/inside/the/rpm/
inside the current directory before actually extracting the file.
Is there any way to extract the file to the current directory without creating the whole directory structure?
Thanks in advance!!
You can use --to-stdout
for cpio
. E.g.:
# rpm2cpio id3lib-3.8.3-28.fc18.x86_64.rpm | cpio -iv --to-stdout ./usr/share/doc/id3lib-3.8.3/README > /tmp/README
./usr/share/doc/id3lib-3.8.3/README
2173 blocks
#