LinuxQuestions.org
Visit Jeremy's Blog.
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, 09:09 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
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, 09:29 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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 09:33 PM.
 
Old 07-20-2011, 12:11 AM   #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 12:02 PM
More tar issues - listing files in a single tar from a multivolume borks Thymox Linux - Software 4 09-23-2009 08:48 PM
how to untar files with tar.tar extension johnkalikavunkal Linux - General 5 07-11-2008 06:36 AM
tar -zxvf foo.tar.gz creates all .gz files prophoto Linux - General 11 11-09-2006 07:27 PM
how to install .tar.bz and src.rpms and tar.gz files gadekishore Linux - Software 1 10-12-2005 09:09 PM


All times are GMT -5. The time now is 12:50 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration