Skip to ContentSkip to Footer
Start of content
- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - Linux
- >
- General
- >
- tar -xf in new directory
General
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Latin America
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-10-2010 09:40 AM
02-10-2010 09:40 AM
tar -xf in new directory
Hi, all
Having problems tar -x archive in new directory.
I created tar file like this:
cd /source/out
tar -cvf bills.tar gm_*.zip
then copied it to new /gm/webserver dir and tried to exract all files being there, and I just realized that it remember it old source/out directory. Nothing extracted.
Tried this:
tar -C /gm/webserver/ -xvvf bills.tar
and still verbose output shows that it points to old /source/out/gm_01.zip path.
and nothing was extracted to /gm/webserver/.
What is the trick here, do I need to use any special option while creating tar -cf ?
Tx to all
Jian
Having problems tar -x archive in new directory.
I created tar file like this:
cd /source/out
tar -cvf bills.tar gm_*.zip
then copied it to new /gm/webserver dir and tried to exract all files being there, and I just realized that it remember it old source/out directory. Nothing extracted.
Tried this:
tar -C /gm/webserver/ -xvvf bills.tar
and still verbose output shows that it points to old /source/out/gm_01.zip path.
and nothing was extracted to /gm/webserver/.
What is the trick here, do I need to use any special option while creating tar -cf ?
Tx to all
Jian
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-10-2010 12:08 PM
02-10-2010 12:08 PM
Re: tar -xf in new directory
> I just realized that it remember it old
> source/out directory. [...]
It did? I don't see why it would, _if_ you
created the "tar" archive the way you said
that you did.
tar tfv bills.tar
> What is the trick here, [...]
It should work as desired if you specify a
relative path, not an absolute path, when
you create the archive.
Relative (often good):
cd /source/out
tar cf /bills.tar gm_*.zip
Absolute (often bad):
tar cf /bills.tar /source/out/gm_*.zip
GNU "tar" also offers some options which
allow the user to modify/transform the paths
when files are extracted.
http://www.gnu.org/software/tar/manual/
http://www.gnu.org/software/tar/manual/html_node/transform.html#SEC108
> source/out directory. [...]
It did? I don't see why it would, _if_ you
created the "tar" archive the way you said
that you did.
tar tfv bills.tar
> What is the trick here, [...]
It should work as desired if you specify a
relative path, not an absolute path, when
you create the archive.
Relative (often good):
cd /source/out
tar cf /bills.tar gm_*.zip
Absolute (often bad):
tar cf /bills.tar /source/out/gm_*.zip
GNU "tar" also offers some options which
allow the user to modify/transform the paths
when files are extracted.
http://www.gnu.org/software/tar/manual/
http://www.gnu.org/software/tar/manual/html_node/transform.html#SEC108
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-14-2010 01:30 AM
02-14-2010 01:30 AM
Re: tar -xf in new directory
>Tried this: tar -C /gm/webserver/ -xvf bills.tar
-C is what you use when creating the tarfile.
>do I need to use any special option while creating tar -cf
You either need to be in that directory as Steven said, or you can use -C:
tar -cvf bills.tar -C /source/out .
(Note: that "*" won't work because you aren't in that directory yet.)
-C is what you use when creating the tarfile.
>do I need to use any special option while creating tar -cf
You either need to be in that directory as Steven said, or you can use -C:
tar -cvf bills.tar -C /source/out .
(Note: that "*" won't work because you aren't in that directory yet.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-18-2010 03:03 PM
02-18-2010 03:03 PM
Re: tar -xf in new directory
This is from the man page.
Archive all files and directories in directory my_project in the
current directory to a file called my_project.TAR, also in the current
directory:
tar -cvf my_project.TAR my_project
sp,
Archive all files and directories in directory my_project in the
current directory to a file called my_project.TAR, also in the current
directory:
tar -cvf my_project.TAR my_project
sp,
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
End of content
United States
Hewlett Packard Enterprise International
Communities
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP