mv - Move All Files Including . Hidden Files - How To for Linux Unix



By default, the mv command will not move files in the source directory that begin with . (also known as hidden files). If you want to move all files (including hidden files that begin with a dot .), run mv like this:
mv ./{*,.*} /destination/directory/here
Below are some examples of a directory structure before and after running mv:
./
├── level1
│ ├── 1
│ │ ├── one.txt
│ │ └── .two.txt
│ ├── 2
│ │ ├── .four.txt
│ │ └── three.txt
│ ├── five.txt
│ └── .six.txt
└── level2
mv ./level1/* ./level2/
./
├── level1
│ └── .six.txt
└── level2
├── 1
│ ├── one.txt
│ └── .two.txt
├── 2
│ ├── .four.txt
│ └── three.txt
└── five.txt
As you see ./level1/.six.txt did not move because it was in the source directory and it was a hidden file. If you were to move it the correct way, it would work and look like this:
mv ./level1/{*,.*} ./level2/
.
├── level1
└── level2
├── 1
│ ├── one.txt
│ └── .two.txt
├── 2
│ ├── .four.txt
│ └── three.txt
├── five.txt
└── .six.txt
Post new comment