473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Create Tar file with a new prefix directory

Hi,

What is the cleanest way to create a tar with a prefix directory in it?

cd /export/home/testbed
tar -cvzf test.tgz *

I need the tar to include "jump"/testbed/<files> in it not just testbed/<files> in it.

There are sed commands out there but I am in search of a cleaner way.

Thanks
Nov 29 '13 #1

✓ answered by Luuk

i do not think that this is possible without temporarily extracting files from the tar-archive

3 3148
Luuk
1,047 Expert 1GB
what do you mean by 'cleaner way'?

Expand|Select|Wrap|Line Numbers
  1. mkdir testbed
  2. cd testbed
  3. tar xvfz ../test.tgz
  4. cd ..
  5. tar cvfz test-newt.tgz testbed/*
  6.  
maybe you even could end with: rm -r testbed
Nov 30 '13 #2
"cleaner way" meaning the least amount of code.

Can the structure within a tar be changed?

directory testbed contains files and subfolders. The directory testbed name needs to be tared with a new name testdone rather than testbed. i.e.

testbed/testing/tester/
to
testdone/testing/tester/

I don't see an option in tar man or online to change or modify the path inwhich the tar is stored.
Dec 2 '13 #3
Luuk
1,047 Expert 1GB
i do not think that this is possible without temporarily extracting files from the tar-archive
Dec 4 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: o'seally | last post by:
solaris/linux admins/rookie_developers that battle with this error are probably all frustrated when it happens. i bet you're also somehow frustrated by this seemingly unsolvable error :-) ...take...
6
by: haynesc | last post by:
Hi, I'm having a problem where when trying to open a file in write mode, I get an IOError stating no such file or directory. I'm calling an external program which takes an input file and...
1
by: Martin Burger | last post by:
Hello, I configured PHP 4.3.11 './configure' '--prefix=~/php-4.3.11' '--enable-memory-limit' '--enable-force-cgi-redirect' '--enable-track-vars' '--with-pcre-regex' '--with-mysql=shared'...
0
by: Dominic | last post by:
I got the following error when I built a project. vcdeploy : error VCD0035: Failed to create the file system directory for the virtual directory. Access is denied. The project / properties /...
0
by: SampathTangudu | last post by:
Hi, We are trying to use the Hash Tables for passing information from one aspx page to another aspx page. We are using the below code. IsolatedStorageFile isoStore =...
3
by: Nathan Sokalski | last post by:
I have several pieces of data that I use the HttpApplicationState for, because they rarely change and are used by everyone. When these pieces of data are created, they are created either from...
0
by: Mel | last post by:
Hi, I got the following error on doing a vacuumdb : NOTICE: RelationBuildDesc: can't open obo_switching_sql: No such file or directory ERROR: _mdfd_getrelnfd: cannot open relation...
3
by: Okonita | last post by:
Hi all, I am having problem completing this restore operation. "db2 restore database AAMI01 from /pap/data/backups taken at 20071002130554 to /pap/data/db01 into AAMI01 NEWLOGPATH /pap/data/new/...
1
by: sandhyabhavani | last post by:
This article is used to zip a file or directory using vb.net. The classes and method to zip a file is availale in java.io, java.util, java.util.zip class library.To import these you have to add a...
0
by: nagashree | last post by:
Hi, i want to compress the file or directory i am able to do that can anybody help me to decompress the file when i double click on the zipped file i am getting the error message as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.