fenningenarius Posted May 29, 2005 Posted May 29, 2005 Hello,I am trying to write a batch file that will create subfolders based on the name of the parent folder (I'm running windows xp). So if the folder that I am working in is named "dg2001-10-19" then I want the batch file to create 3 subfolders named "dg2001-10-19 - WTA", "dg2001-10-19 - BHMM" and "dg2001-10-19 - files". In the other folders that I am working in I want it to work the same way - for a folder named "disc" it would create "disc - WTA", "disc - BHMM" and "disc - files" and place them in the disc folder.If anyone can help me I would really appreciate it. I realize that this is probably a simple thing but I am not very familiar with programming or batch files. Thank you very much for your help.
Yzöwl Posted May 29, 2005 Posted May 29, 2005 I could help with it although I am a little busy today!In the meantime, if you let me know how you want to do it, it would help.For instance, how do you want to tell it which folder, you are in or wish to work on etc.
fenningenarius Posted May 29, 2005 Author Posted May 29, 2005 In the meantime, if you let me know how you want to do it, it would help.For instance, how do you want to tell it which folder, you are in or wish to work on etc.<{POST_SNAPBACK}>I'm not really sure. Like I said I'm not very familiar with this kind of stuff. I have another batch file that I wrote that opens a program called shntool.exe which is used to analzye .wav files - it is my only experience with batch files so far. The way that it works is that I went into Tools>Folder Options>File Types and clicked on .wav files, then I added a new action to be associated with .wav files and in the "application to perform this action" field I entered the path to my batch file. I named the action "shntool". Now when I right-click on any wav file there is an item in the list called "shntool". If I click on that it runs the batch file on all the files in that folder. I was thinking that this could work in a similar way except that it could be associated with "file folder" or "folder". That way I could right-click on folders in windows explorer and there would be a new action which would create the subfolders for me. If this is not possible then forgive me for wasting your time. It would just save me so much time if I could get something like this to work but I don't really know how to do it. Thanks so much for your help, I really appreciate it.
Yzöwl Posted May 30, 2005 Posted May 30, 2005 okay, here's a little something to wet your appetite@echo off&setlocal enableextensionsif '%1' equ '' echo You must provide a directory to work on! e.g. %~0 C:\MyDir&pause&goto :eofif not exist "%~1" echo The specified directory does not exist!&pause&goto :eofset subextns=WTA BHMM filesfor %%a in (%subextns%) do pushd %1&md "%~n1 - %%a"&popdendlocal&goto :eof
fenningenarius Posted May 30, 2005 Author Posted May 30, 2005 That worked! Thank you so much for your help. I went into 'folder options'>'file types'>'file folder' and added a new action which runs that batch file. Now I can right click on any folder and select that action and it makes my 3 folders. I am really excited, this is going to save me a LOT of time. I really appreciate your help, thank you so much. -will
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now