There are 100 folders of the form:

папка1\файлы и папки папка2\файлы и папки папка3\файлы и папки ... 

tell me how to create a folder in each folder with the name "folder" and transfer the contents of this folder to it to make it:

 папка1\folder\файлы и папки папка2\folder\файлы и папки папка3\folder\файлы и папки 

    1 answer 1

    If these 100 folders have a specific name format or are in a directory where there is nothing more, then you can use this option:

     for i in *; do mv "$i" folder && mkdir "$i" && mv folder "$i"/; done 

    It was:

     $ ls -lhFAQ * "папка1": итого 8,0K drwxr-xr-x 2 mah69k mah69k 4,0K сен 22 12:25 "папка11"/ drwxr-xr-x 2 mah69k mah69k 4,0K сен 22 12:25 "папка12"/ -rw-r--r-- 1 mah69k mah69k 0 сен 22 12:25 "файл11" "папка 2": итого 0 -rw-r--r-- 1 mah69k mah69k 0 сен 22 12:25 "файл21" -rw-r--r-- 1 mah69k mah69k 0 сен 22 12:25 "файл 22" "папка3": итого 4,0K drwxr-xr-x 2 mah69k mah69k 4,0K сен 22 12:25 "папка 31"/ 

    It became:

     $ ls -lhFAQ * "папка1": итого 4,0K drwxr-xr-x 4 mah69k mah69k 4,0K сен 22 12:25 "folder"/ "папка 2": итого 4,0K drwxr-xr-x 2 mah69k mah69k 4,0K сен 22 12:25 "folder"/ "папка3": итого 4,0K drwxr-xr-x 3 mah69k mah69k 4,0K сен 22 12:25 "folder"/ $ ls -lhFAQ */* "папка1/folder": итого 8,0K drwxr-xr-x 2 mah69k mah69k 4,0K сен 22 12:25 "папка11"/ drwxr-xr-x 2 mah69k mah69k 4,0K сен 22 12:25 "папка12"/ -rw-r--r-- 1 mah69k mah69k 0 сен 22 12:25 "файл11" "папка 2/folder": итого 0 -rw-r--r-- 1 mah69k mah69k 0 сен 22 12:25 "файл21" -rw-r--r-- 1 mah69k mah69k 0 сен 22 12:25 "файл 22" "папка3/folder": итого 4,0K drwxr-xr-x 2 mah69k mah69k 4,0K сен 22 12:25 "папка 31"/ 
    • Yes, the format of the name of these hundred folders is one - these are the names of sites like: "site.ru", "site.com", "site.net". And they are in the catalog in which there is nothing more - Novice
    • @ Newbie: then the asterisks as a mask will be enough. - MANKK