Reputation: 2979
I was trying to learn bash basics. I was trying out how */.*
displays all invisible files in all subdirectories in folder notes-bash
:
~/anir/repos/notes-bash$ find */.*
images/.
images/./bashrepl.png
images/..
images/../.git
images/../.git/COMMIT_EDITMSG
:
del/.
del/..
del/../.git
del/../.git/COMMIT_EDITMSG
del/../.git/HEAD
:
I am not getting why it is listing files as images/..
. Doesnt that mean same folder as notes-bash
? I guess it is simply trying to find /.
in all possible directories. Thus it recurs through all subdirectories (here images
and del
) to force form paths with /.
as substring.
Q1. Am I correct with this?
So I next created subdirectory del/del1
and ran following command to check all paths formed passing through del1
:
$ find */.* | grep del1
del/./del1
del/../del/del1
images/../del/del1
Q2. So, now I am guessing why it did not recur through del1
, that is why it did not list paths such as del/del1/../../.git
?
Upvotes: 0
Views: 210
Reputation: 117298
I was trying out how /. displays all invisible files in all subdirectories in folder
notes-bash
This will list all files starting with a .
in the current directory and all subdirectories:
~/anir/repos/notes-bash$ find -name '.*'
I am not getting why it is listing files as
images/..
It's because the first *
in your find
matches a directory named images
inside notes-bash
.
I next created subdirectory
del\del1
No, you didn't. You created a subdirectory named del
and possibly subdirectory of that named del1
. del/del1
would be the appropriate reference to it.
Your guess regarding why del1
isn't showing up everywhere is a bit off. Just do
echo */.*
and see what it displays. Those are the files and directories that your find
command will work with.
Upvotes: 1