Skip to main content
Tweeted twitter.com/#!/StackUnix/status/623221099187318784
added 40 characters in body
Source Link
Black
  • 2.1k
  • 8
  • 38
  • 64

I try to pack a .csv file with tar.gz, while being in the root directory.

The file myfile.csv is located at /mnt/sdb1/ So the full filename is /mnt/sdb1/myfile.csv

I try to save the tar.gz under /mnt/sdb1/old_files

I tried it like this:

tar -czf /mnt/sdb1/old_files/new.tar.gz mnt/sdb1/myfile.csv 

But when i extract the file, then a folder with name "mnt" will be extracted which cointains another folder called "sdb1", which contains the file.

Is it possible to compress the file only, instead of copying all the directories?

I try to pack a .csv file with tar.gz, while being in the root directory.

The file myfile.csv is located at /mnt/sdb1/ So the full filename is /mnt/sdb1/myfile.csv

I try to save the tar.gz under /mnt/sdb1/old_files

I tried it like this:

tar -czf /mnt/sdb1/old_files/new.tar.gz mnt/sdb1/myfile.csv 

But when i extract the file, then a folder with name "mnt" will be extracted which cointains another folder called "sdb1", which contains the file.

Is it possible to compress the file only?

I try to pack a .csv file with tar.gz, while being in the root directory.

The file myfile.csv is located at /mnt/sdb1/ So the full filename is /mnt/sdb1/myfile.csv

I try to save the tar.gz under /mnt/sdb1/old_files

I tried it like this:

tar -czf /mnt/sdb1/old_files/new.tar.gz mnt/sdb1/myfile.csv 

But when i extract the file, then a folder with name "mnt" will be extracted which cointains another folder called "sdb1", which contains the file.

Is it possible to compress the file only, instead of copying all the directories?

Source Link
Black
  • 2.1k
  • 8
  • 38
  • 64

Pack file with tar.gz from root directory

I try to pack a .csv file with tar.gz, while being in the root directory.

The file myfile.csv is located at /mnt/sdb1/ So the full filename is /mnt/sdb1/myfile.csv

I try to save the tar.gz under /mnt/sdb1/old_files

I tried it like this:

tar -czf /mnt/sdb1/old_files/new.tar.gz mnt/sdb1/myfile.csv 

But when i extract the file, then a folder with name "mnt" will be extracted which cointains another folder called "sdb1", which contains the file.

Is it possible to compress the file only?