May 14, 2012
tom

Command: move all files inside a directory to another directory (including hidden files)?

Question

I tried to move all files inside a directory to another directory like this:

$ mv /directory_one/* /directory

However, the hidden files (such as .htaccess) in /directory_one won’t be moved.

What is the right command to do so?

Asked by gilzero

Answer

This should do it:

mv /directory_one/* /directory_one/.* /directory

It will move regular files and dotfiles.

Answered by Quinn Murphy

Related posts:

  1. chmod all files (including hidden files) in a directory in Linux (not recursively)
  2. Bash snippet to move all files in a directory into that directory
  3. Copying a directory from one UNC share to another using ‘move’ command fails with an access denied error but works in Windows Explorer
  4. How to view hidden files using Linux `find` command
  5. Huge directory, not files inside, but directory itself

Leave a comment