OK Paul. You're very? close! Good job/try!
Here's what you need to do:
rm -f .*.*(
so,
rm, space, dash f, space, dot star, dot star.
The rm is for remove. dash f is the switch which you are going to pass
through the rm command, which forces deletion without nagging you if you are
sure on each individual file, as that could be really annoying, depending on
how many files you have.
Whatever you do, *don't!* do, and I repeat, don't! do rm, dash r f. Do?
not! use the R switch! If you do this it will recurse all sob folders, and
in combination especially with the f switch could be a disaster, giving you
no choice of the matter.
star is a wildcard, you are correct, to say anything which starts with...
but here's what you're forgetting... it also means that ends! with.
So, let me give you two examples.
Let's say you want to remove all files which start with bird. b i r d.
So,:
rm -f bird*.*
Say you wanted to delete all files which started with bird, that also had a
txt extension.
rm -f bird*.txt
So, any directory starting with a dot means it's a hidden directory. OK?
So, in this context, the dot isn't being used as the file name/extension
separator.
For this reason, you need to specify any file which starts with a dot.
so rm, space, dash f, space, dot star
Then you want any extension, so...
rm, space, dash f, space dot star, dot star.
That second dot is your seporator from the file name/extension.
so dot star, (any file starting with a dot, dot star, and with any file
extension.
.*.* (dot star, dot star.)
So the whole command should look like
cd /Volumes/[Name of your drive volume]
Don't forget, tab completion is your friend. Use it!
ls -1
Just to be sure, we're in the right directory.
rm -f .*.*
There you go.
If this doesn't work,
chmod 660 .*.*
then:
rm -f .*.*
Chris.
----- Original Message -----
From: "Paul Erkens" <[email protected]>
To: <[email protected]>
Sent: Tuesday, April 23, 2013 6:57 AM
Subject: terminal question: wildcards
Dear listers using terminal,
How do I match all files starting with a period? I thought
.*
would be simple enough, but if I do
ls .*
on my external drive, which is os extended journaled, then all files in
that dir show up. If I do the same command in my normal home directory,
then the same thing happens.
What I'm trying to do is delete all files starting with a dot in the root
of an external drive, because that's an advice I found in another forum
for a different problem I'm having. Why do all files seem to show up when
doing
ls .*
rather than just those whose name starts with a dot? I think I'm missing
something. What is it?
Paul.
--
You received this message because you are subscribed to the Google Groups
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/macvisionaries?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/macvisionaries?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.