Linux command: move all files and folders in the current folder to a new folder under the current folder.

for example, the file structure is as follows:

file1
file2
directory/file3
directory/file4

now move all the above files and folders to a new folder newDirectory . How does the command line implement?
filenames may be irregular filenames, and there may be a large number of them.

Mar.26,2021

if it is bash (other shell is not clear), directly mv * newDirectory/ . Because when mv newDirectory newDirectory is executed, an error will be reported that it cannot be copied, but ignore this error


you execute mv * / home/test/ directly under your current directory, as long as you have this test directory. In this way, all the current files will be moved to


sudo mv file {1pm 2} directory* newDirectory/

.
Menu