LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-19-2011, 08:09 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
tar files


I use the command "tar -zcvf tar.tgz /tmp/edp" can successfully tar files , it works fine but it will tar all files under /tmp/edp includes the sub folders , if I just want to tar the files in current path only ( not do the files in the sub folder of /tmp/edp ) , can advise what can i do ?

Thanks.
 
Old 07-19-2011, 08:29 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
tar, by itself, can't do that. You could try something like this (untested):
Code:
find /tmp/edp -type f -maxdepth 1 | tar -cvzf tar.tgz -T -

Cheers,
Tink

Last edited by Tinkster; 07-19-2011 at 08:33 PM.
 
Old 07-19-2011, 11:11 PM   #3
David Triebwasser
LQ Newbie
 
Registered: Jul 2011
Location: Richmond, CA
Posts: 7
Blog Entries: 1

Rep: Reputation: Disabled
use the --exclude flag
$ man tar | grep exclude
exclude files based upon PATTERN
exclude files listed in FILE
 
  


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
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
More tar issues - listing files in a single tar from a multivolume borks Thymox Linux - Software 4 09-23-2009 07:48 PM
how to untar files with tar.tar extension johnkalikavunkal Linux - General 5 07-11-2008 05:36 AM
tar -zxvf foo.tar.gz creates all .gz files prophoto Linux - General 11 11-09-2006 06:27 PM
how to install .tar.bz and src.rpms and tar.gz files gadekishore Linux - Software 1 10-12-2005 08:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:39 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration