-2

I am trying to use tar to compress the subdirectories /root/folder/folder{1..5} into a single compressed archive test1.tar.bz2. I'm using the following command:

tar -cvjf test1.tar.bz2 root/folder/folder{1..5}

Unfortunately this is not working and I'm getting the following output:

tar: root/folder/folder1: Cannot stat: No such file or directory
tar: root/folder/folder2: Cannot stat: No such file or directory
tar: root/folder/folder3: Cannot stat: No such file or directory
tar: root/folder/folder4: Cannot stat: No such file or directory
tar: root/folder/folder5: Cannot stat: No such file or directory
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

closed as off-topic by Kusalananda, sebasth, Rui F Ribeiro, A.B, msp9011 Aug 31 '18 at 4:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Kusalananda, sebasth, Rui F Ribeiro, A.B, msp9011
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Please, whenever possible, post text instead of images. – maulinglawns Aug 30 '18 at 12:07
  • In future you should copy and paste the text from a terminal rather than posting a picture, this will use less storage on the server and make it easier for other users to copy the text. – rusty shackleford Aug 30 '18 at 12:07
  • I updated your question to use text instead of an image. You might also want to use a file name like test1.tar.bz2 instead of test1.tar to reflect the fact that the archive was compressed using the bzip2 algorithm (i.e. using the -j flag). – igal Aug 30 '18 at 23:28
2

You are using a relative path rather than an absolute path.

Change:

root/folder/folder{1..5}

Too (correct absolute path):

/root/folder/folder{1..5}

Or (correct relative path):

folder/folder{1..5}

Explanation:

You are inside of roots home directory (/root), so relative paths will be /root + relative_path, so in your case you're giving tar the path /root/root/folder/folder{1..5} which does not exist. You can either give the correct relative path (omitting the root/ at the beginning) or give the absolute path.

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