How to Create Multiple Folders

I have a directory of files and want to create separate folders for each file is there a way to do this in Dolphin? I know in windows there is a program called file2folder that does this in the context menu in explorer and names the folder after the file. Please advise, thanks!

1 Like

Can you explain what you mean? You have files like file1 and file2 and you want to create directories called file1 and file2 and put the files inside those directories so then you will have file1/file1 and file2/file2?

Looks like an interesting project!

Have you scrolled through Dolphin service menus? Maybe there’s something there you can use as a starting point? I found Create folder from selected files which may partially get you there. (I haven’t looked at it myself but the title seems promising.)

Since the solution probably will be based on the command-line, look for custom actions for other file managers as well for clues.

More (by searching for “bash make folders for individual files and move files to respective folders”):

There’s an easier way. For example:

for f in *; do mkdir "directory-for-$f"; done

The other question is: what are you actually trying to do?


That’s the best way to do it.

Perhaps it would also be desirable to move each file into each corresponding directory, like this:

for f in *; do mkdir "directory-for-$f" && mv "$f" "directory-for-$f"; done

Maybe add a check for files only, so that directories are left alone?

I do wonder what is the purpose of it :slight_smile:


I will give your suggestions a go. Much appreciate all of your feedback, sorry for the delayed response. I have accumulated recipes, stuff while in school, eBook manuals, videos etc and they are all in my download directory. I want to create a folder for each of them and then transfer them over to my NAS so I can get organized for 2022. I just dread doing it manually, that is why I have so much stuff now. I used the file2folder program in windows for years but I now use Endeavor-OS and am still in the learning process with Linux. You guys have been great to me and I really appreciate it.