I’ve got
- Folder-A
- Folder-A1 (<– files in it)
- Folder-A2 (<– files in it)
- Folder-B
- Folder-B1 (<– files in it)
- Folder-B2 (<– files in it)
What I’ like to get
- Folder-A
- Folder-A1
- Folder-A1-Subfolder (<– moved files in it)
- Folder-A2
- Folder-A2-Subfolder (<– moved files in it)
- Folder-A1
- Folder-B
- Folder-B1
- Folder-B1-Subfolder (<– moved files in it)
- Folder-b2
- Folder-B2-Subfolder (<– moved files in it)
- Folder-B1
At first it looks complicated. But all I want to do is move files in all folders just one folder down in the same folder (subfolders have to be created, great if it contains the name of its parent folder).
Is there any way I can do it with a bash command? Or an App?
Hope you have some tipps for me 🙂
This can be done in a bash one-liner with find (it’s probably possible to make this easier/smaller, but i’m no shell guru):
(Find all non-directory files, move them from their original position to ‘foldername/foldername-Subfolder/filename’. This has to be done with
bash -cbecause the subshells would otherwise be evaluated first)You need to create the subfolders before executing the command, which can be done with another find: