Create folder from file name

Advertisement

nickodemos
Joined:
Posts:
2

Create folder from file name

Was wondering if it would be possible to have a script that would create folder based on the file name.

EG I would click on BSD.iso and choose the script to create a folder in current folder with the name BSD and move the BSD.iso into the newly created BSD folder.

I did a quick search and found nothing asking this.

Reply with quote

Advertisement

nickodemos
Joined:
Posts:
2

Sorry I should have thought to put that in.

Yes. On the remote folder I would right click on a file to bring up the context menu and have an option under 'Custom File Commands' that would create a folder and move the file I clicked on into the newly created folder: root/BSD.iso >> root/BSD.iso/BSD.iso.

Only thing better would being able to remove the extension in the folder.

root/BSD.iso >> root/BSD/BSD.iso.

Reply with quote

martin
Site Admin
martin avatar

I'm no *nix expert, so there can be a better solution, but should should do:

filename="!" && mkdir "${filename%.*}" && mv "!" "${filename%.*}"

Reply with quote

Advertisement

You can post new topics in this forum