tar files not the folders
Hello
Im trying to tar a some stuff in a other folder with this command tar czvf test.tat.gz /home/apa/test/ (just a test) But when i extract it later i get the hole /home/apa/test/ structure, is there anyway of tar just the files? |
Hi,
Have a look at the man page for tar. The -C option changes to the directory and tars them. Don't forget to terminate your command with a . (dot). Or do it manually, that is, change to the directory and just tar the files. Kind regards, Eric |
Quote:
|
Hi,
Sorry if I was unclear, after re-reading my post I understand it must be confusing. I refer to the dot when using the command from within the directory, meaning first cd into the directory you want to include files from and then run tar like this: Code:
tar cvf tarfile.tar -C <dir> . Kind regards, Eric |
Cool!
Is it possible to do just get the folder where all the files are in, sounds strange, i think its easier to show a example. /opt/logs/1/hejsan.txt /opt/logs/2/hejsan.txt /opt/logs/3/hejsan.txt what i want is to be able to be in one directory (say /home/apa) and create a tar archive from there that, and when you untar in you get 1/hejsan.txt or 2/hejsan.txt |
Hi,
When you change into the directory /opt/logs: Code:
cd /opt/logs Code:
tar cvf filename.tar . Code:
tar xvf filename.tar Code:
man tar Kind regards, Eric |
All times are GMT -5. The time now is 07:39 AM. |