0

Possible Duplicate:
tar – extract discarding directory structure

I have a tar file that include sub-directories each has several files. I need to extract all those files into one directory. Any help?

Labibah
  • 103
  • 1
  • 3

1 Answers1

0

Operating system not stated. Assuming some *nix-like variant.

Assuming TAR file tarfile.tar in the current directory:

mkdir temp dirwithfiles
tar xvf tarfile.tar -C temp
find temp -type f -exec mv -i {} dirwithfiles \;
rm -r temp

This will extract the full directory structure, then move all files within to the dirwithfiles directory.

Note mv -i since there might be several files with the same filename that need to be selected from.