How to recursively move all files (including hidden) in a subfolder into a parent folder in *nix?

Posted by deadprogrammer on Server Fault See other posts from Server Fault or by deadprogrammer
Published on 2010-03-13T19:26:04Z Indexed on 2010/03/13 19:35 UTC
Read the original article Hit count: 321

Filed under:
|
|
|

This is a bit of an embracing question, but I have to admit that this late in my career I still have questions about the mv command.

I frequently have this problem: I need to move all files recursively up one level. Let's say I have folder foo, and a folder bar inside it. Bar has a mess of files and folders, including dot files and folders. How do I move everything in bar to the foo level?

If foo is empty, I simply move bar one level above, delete foo and rename bar into foo. Part of the problem is that I can't figure out what mv's wildcard for "everything including dots" is. A part of this question is this - is there an in-depth discussion of the wildcards that cp and mv commands use somewhere (googling this only brings very basic tutorials).

© Server Fault or respective owner

Related posts about nix

Related posts about command-line