LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 10-15-2018, 01:46 PM   #1
kkhalil
LQ Newbie
 
Registered: Oct 2018
Location: los angeles
Posts: 2

Rep: Reputation: Disabled
how can I only tar file and not the directories in linux


how can I only tar files and not the directories in linux
 
Old 10-15-2018, 02:13 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
Welcome to LQ
Look at:
man tar
http://man7.org/linux/man-pages/man1/tar.1.html
https://www.tecmint.com/18-tar-comma...ples-in-linux/
 
1 members found this post helpful.
Old 10-15-2018, 02:24 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,979

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Post your example of the command that you are trying to use. I suspect it will not be a file or set of files.
 
Old 10-15-2018, 02:51 PM   #4
kkhalil
LQ Newbie
 
Registered: Oct 2018
Location: los angeles
Posts: 2

Original Poster
Rep: Reputation: Disabled
here is what I was able to do:
[find . -maxdepth 1 -type f -print0 | xargs -0 tar cvf onlyFiles_No_Dirs.tar]

Hopefully I tagged my command as code.

Also, I must give credit to where I was able to find this command originally, before my minor tweak: https://unix.stackexchange.com/quest...no-directories

Last edited by kkhalil; 10-16-2018 at 01:35 PM.
 
Old 10-16-2018, 02:57 AM   #5
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 290Reputation: 290Reputation: 290
Quote:
Originally Posted by kkhalil View Post
here is what I was able to do:
find . -maxdepth 1 -type f -print0 | xargs -0 tar cvf onlyFiles_No_Dirs.tar
It works for me. Is your problem resolved then? If so, please mark your thread as [SOLVED] (see howto in my sig).
PS: please use [CODE] tag for your commands/output/code (see my sig as well).
 
1 members found this post helpful.
  


Reply



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
[SOLVED] tar multiple directories into one file davedpss Linux - Newbie 8 05-16-2011 02:21 PM
[SOLVED] command for tar'ing multiple sub-directories into a single tar file blainemiller Linux - Server 3 04-21-2011 02:05 PM
extract tar.gz file in other directories shifter Linux - Newbie 4 06-15-2010 04:09 AM
Listing directories only from tar file? Ion42 Linux - Newbie 2 11-12-2006 11:27 AM

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

All times are GMT -5. The time now is 05:53 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
Open Source Consulting | Domain Registration