Hi folks,

I'll first explain three commands that work as expected, then I'll
provide fourth that doesn't quite do what I expect it to do. I've been
banging my head against this for over a full workday and could use
fresh sets of eyes.I tried this mostly on GNU tar version 1.17 but
found the same results in 1.14 from another machine I had tested on.

1. When I perform a tar -cf somefile.tar . it tars the current
directory I'm in, including hidden files & directories.  (expected
behavior)
2. When I perform a  tar -cf somefile.tar * it tars the current
directory I'm in, excluding hidden files & directories. (expected
behavior)
3. When I perform a tar -cf somefile.tar --no-recursion *, it tars the
current directory I'm in, and (now empty) directories for non-hidden
directories. It does not include any files in any sub-directories.
(expected behavior)
4. However, when I perform a tar -cf somefile.tar --no-recursion .  it
tars an empty directory called . with no files nor directories in it
what so ever. (not what I expected)

Example:
[EMAIL PROTECTED] Pictures]$ ls -a .
.  ..  .hiddenfile  .hiddenfolder  realfile  realfolder  someotherfile.txt

[EMAIL PROTECTED] Pictures]$ sudo tar cf somefile.tar --no-recursion *
[EMAIL PROTECTED] Pictures]$ tar tf somefile.tar
realfile
realfolder/
someotherfile.txt
[EMAIL PROTECTED] Pictures]$ sudo tar cf somefile2.tar --no-recursion .
[EMAIL PROTECTED] Pictures]$ tar tf somefile2.tar
./
[EMAIL PROTECTED] Pictures]$ sudo tar cf somefile3.tar .
tar: ./somefile3.tar: file is the archive; not dumped
[EMAIL PROTECTED] Pictures]$ tar tf somefile3.tar
./
./somefile2.tar
./.hiddenfolder/
./.hiddenfolder/.hiddenfileinisidehiddenfolder
./.hiddenfolder/fileinsidehiddenfolder
./realfolder/
./realfolder/realfileinrealfolder
./realfolder/.hiddenfileinrealfolder
./realfolder/someotherfileinrealfolder.txt
./someotherfile.txt
./realfile
./.hiddenfile
./somefile.tar
[EMAIL PROTECTED] Pictures]$ echo wtf
wtf


Am I simply using it incorrectly? If so, what is a simple way to
non-recursively tar a directory that contains hidden files?


Reply via email to