Timeline for Tar ignores --directory option
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 15, 2018 at 21:03 | comment | added | alyms108 | An earlier iteration of the script did involve explicitly changing directories. I took it out because I wanted to see if everything (change directories and archive) could be done in the same command. Regardless of which method I go with, at least I've learned more about tar. | |
| Jun 14, 2018 at 10:26 | comment | added | Nasir Riley | @alyms108 As you're running this from a script, you can add code to move into the directory that contains the directory that you want to archive and in that case, you won't need the -C. | |
| Jun 14, 2018 at 3:58 | comment | added | Nasir Riley | @alyms108 You already accepted another answer but I added the -C in order to remove the nesting since you want it to be cleaner in your case. The command now only zips the Pictures directory and nothing else. | |
| Jun 14, 2018 at 3:57 | history | edited | Nasir Riley | CC BY-SA 4.0 | Pictures; added 25 characters in body |
| Jun 14, 2018 at 2:24 | comment | added | alyms108 | This does work. The problem is with $DEST at the end; because it's an absolute path, the resulting archive has extra empty directories above "Pictures". Basically, instead of just archiving "Pictures" I end up archiving "/home/$USER/Pictures". That's why I wanted to change directories first so I could just use the directory name. The nesting isn't a huge issue, I just want to avoid it for the sake of neatness. | |
| Jun 14, 2018 at 2:13 | history | answered | Nasir Riley | CC BY-SA 4.0 |