Jump to content

Create Folders using Filenames


Guest

Recommended Posts

This is a short and sweet batch script file that will be placed inside a directory full of files. This script will be launched by double clicking on the file.. it will then create folders using each filename and place the files inside.

This script became useful for fixing a directory which became slow to browse using Windows Explorer ( or other file browser ) because of the size and/or number of loose files within that directory. I used this to speed access to my main video library which is on a Linux-based filesystem, over a network. This also happens with other filesystems.. when a query is made to list files in said directory using certain methods..

The script also makes it easy to store additional files and folders per item as well, taking on the main brunt of the issue.

The script:

@echo off
for %%a in (*.*) do (
md "%%~na" 2>nul
move "%%a" "%%~na"
)
cd ..
del %%~na
pause

You may copy the script into a notepad document, naming it as 'folder.bat.txt. After it is saved.. you will then remove the .TXT extension and double click on the file within the directory you want folders created for.

You may also download the file here:

folder.zip

Nice quick solution..

Edited by Guest
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...