Situation :
$ mkdir foo && touch foo/.test
$ cp foo/* .
zsh: no matches found: foo/*
(or bash : cp: cannot stat ‘foo/*’: No such file or directory)
I have a directory full of hidden folders and files. What is happening and what is the solution?
|
Disclaimer: This answer deals with Bash specifically but much of it applies to the question regarding glob patterns! The star character ( ExamplesFirst let's create some sample data.
So now we have the following:
Now let's play some games. You can use the command
Changing the behavior?You can use the command excerpt from the
Example:
You can revert this behavior with this command:
Your situation?For you you're telling
Or you can do this if you want everything in the
Or you can be explicit:
A more compact form using brace expansion in
At any time you can use the
Incidentally if you're going to copy a directory of files + other directories, you typically want to do this recursively, that's the
|
|||||||||||||||||||||
|
|
With
Note that with or without |
||||
|
|
|
The shell is treating those files as hidden when it resolves the You can copy them by explicitly specifying |
|||
|
|
|
Stéphane Chazelas's zsh answer is correct for a single glob. However, if you want to set it for all globs you can use
Put it in your |
|||
|
|
|
If what you're wanting to do is copy all files & directories from one place to another, you could use the standard
will recursively copy all of the contents of
There are many other options available tweak rsync, including copying between machines. |
|||
|
|
dotglobis translated toglobdotsby zsh which is invalid option name for bash. – Chinggis6 Aug 27 '17 at 17:21