You can try this alternative process –– remain in the path
/myuser/downloads/
but, instead of first creating the /myuser/downloads/new/
directory, instead create a folder in the /myuser/
directory, with the command mkdir ../new
, then move all the files in downloads
to new
, and finally move new
into downloads
. You can do this in one line, while in the /myuser/downloads/
path, with the command:
mkdir ../new && mv * ../new && mv ../new ../downloads
In this case, you don't have to worry about any sort of "filtering" of files/folders, since new
is on the same level of the path as downloads
, so you can just move everything in downloads
to new
, and then move new
into downloads`.
However, if you already have the subfolder new
created and don't want to create another one, not to worry –– just change the mkdir
command on the left-hand side of the first &&
in the command shown above to an mv
command, pushing new
up in the path; in other words, while you're still in /myuser/downloads/
, you can change mkdir ../new
to mv new ..
. Then the subfolder new
[in the path /myuser/downloads/new/
] gets pushed up to /myuser/new/
, at the same level as /myuser/downloads/
, and then you can run the rest of the command as it is shown above. All together, we have, starting from the path /myuser/downloads/
:
mv new .. && mv * ../new && mv ../new ../downloads
and, since you wanted to "move all files and folders/sub-folders in the downloads folder to the sub-folder [new
]", you're done! If you had wanted to move only files (or only folders or [insert more granular object movement]), then you'd have to use other commands that can "filter" objects, such as grep
. The commands written above are sufficient for your purposes, though.
mv * new
Though, it will whine "cannot move new to new" or something similar. Perhapsmv -i * new
to you prevent overwrites.