0

Suppose I have three files on disk as f1,f2,f3 and one folder is present and in my archive only f4,f5 files are present. So after untar operation I wanted f1,f2,f3 files to be removed/deleted as they are not present in archive and with same time some files/folders need to be excluded and only f4,f5 files with test folder should be there on disk/file system. Is that possible?

Local disk f1,f2,f3,/testfolder In tar archive f4,f5 After untar f4,f5,/testfolder this should present(while doing untar have to exclude folder from disk and delete files which are not present in archive) Please provide solution as this is on high priority. Thank you.

2

What about this:

  1. Untar to a temp directory.
  2. Remove the original directory.
  3. Move the temp directory, so that it substitutes the original one.

Depending on you preference, you'll have to take care of any subdirectories in the original one. Either preserve or get rid of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.