LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 04-13-2005, 08:06 AM   #1
EcceVery
Member
 
Registered: Apr 2004
Location: Sweden
Distribution: Gentoo, Debian, CentOS
Posts: 61

Rep: Reputation: 15
Strip leading dot in filepaths (in tar archive)


I'm putting together a archive containing some programs and symlinks in /etc/rc2.d (for debian systems). When the file is extracted I want some of the files to be placed in /etc,some in /etc/init.d and so on. I have created that exact path in another directory and tar'ed the files, but when I list the contets I get aleading dot in the beginning of all file paths.

How do I strip just the leading dot, leaving the rest of the path untouched in the archive?
 
Old 04-13-2005, 04:06 PM   #2
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
What command did you use to create the tar archive ?

mj
 
Old 04-13-2005, 07:47 PM   #3
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 33
There are different approaches you can take.................You probably used the 'find' command for adding the files to tar, or used "tar -cf xxxx.tar ."........

Normally, 'tar' will strip the leading forward slash (/) if given an absolute path, however if you used 'find' while in the directory containing the files and directories you are trying to store, and using this syntax "find ." (or "find" by itself), it will add "./" at the beginning of each path............To avoid this, you must enter the name of the directory to find to get a full path, such as "find /etc/init.d /etc/rc2.d"..............When fed to tar, tar will automatically strip the leading / from the path, thus making it a relative path instead of an absolute path, unless you add the switch to keep it as an absolute path (tar -P, or tar --absolute-names).......

If you used "tar -cf xxx.tar ." this will also create files with a leading "./"...............Instead, you must again supply the name of the directory here, such as "tar -cf xxx.tar /etc/init.d /etc/rc2.d", to avoid the "./" at the beginning

HTH

Last edited by thegeekster; 04-13-2005 at 07:49 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/bin/tar: Removing leading `/' from member names guarriman Linux - General 16 02-09-2010 08:19 PM
how to tar dot files? rocky180 Linux - Newbie 6 08-22-2007 03:54 AM
old tar? archive maenho Linux - Software 4 12-14-2006 07:05 PM
Tar gives error when creating a tar file archive davidas Linux - Newbie 10 04-13-2004 12:35 AM
this doesn't look like a tar archive .phister Slackware 5 02-01-2004 01:19 AM


All times are GMT -5. The time now is 11:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration