Pipe Output of ls -lR into a tar archive

Ed K. ed at hp.uab.edu
Fri Jun 18 19:24:05 UTC 2004


On Fri, 18 Jun 2004, Ow Mun Heng wrote:
> On Fri, 2004-06-18 at 11:58, Ed K. wrote:
>> On Fri, 18 Jun 2004, Ow Mun Heng wrote:
>>> On Fri, 2004-06-18 at 11:23, Ed K. wrote:
>>>> On Fri, 18 Jun 2004, Ow Mun Heng wrote:
>>>>> I need help,
>>>>>
>>>>> 	EIther google isn't finding the stuffs or my search terms are too
>>>>> muddled.
>>>>>
>>>>> I just want to create a tar archive from a directory file listing.
>>>>>
>>>>> something like
>>>>>
>>>>> ls -laR ~/the/dir/to/list | tar -cvf - /tmp/tarred-dir-list.tar.gz
>>>>>
>>>>> I can't seem to find the correct syntax
>>>>
>>>> I think you are looking for something like:
>>>>
>>>> find ~/the/dir/to/list -type f | tar -cvf /tmp/tarred-dir-list.tar.gz -T -
>>>
>>> This didn't work either.  End up with the same problem as Alexander's suggestion.
>>>
>>> I only want the directory listing. I do not want to tar up the files too
>>>
>>
>> hum, then try:
>>
>> find ~/the/dir/to/list -type d | tar -cvf /tmp/tarred-dir-list.tar.gz -T - --no-recursion
>
> This just gives me directory names. What about the files in it? If I use -type f I get a complete tar!
>

I'm not sure any more what you want. Are you sure you want to use tar? Just to save a directory listing, a 
single file, could be done with:

ls -laR ~/the/dir/to/list | gzip > /tmp/dir-list.gz

tar is used to backup files.

ed

Security on the internet is impossible without strong, open, 
and unhindered encryption.





More information about the fedora-list mailing list