• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Such a program to convert excel files to folders?

dmcowen674

No Lifer
Is there such a program to convert excel files to folders?

I have 150 excel files that have to be put into individual folders.

Each file is a unique number so is there a parser program that can create folder directories directly?

 
VBA Macro with a list of the excel files would work. Do the following

1. Run dir/b to get list of excel files
2. copy and paste list into excel spreadsheet, strip out .xls
3. Copy and paste code into VBA window, and run it. You can change the C:\test to whatever directory you want. I even went a step further to copy the file into the newly created folder if you want it to do that. If not, delete the 2 lines after the first shell command.

Private Sub CreateFolders()
On Error GoTo Err_CreateFolders
Dim i As Integer
Dim wrk As Worksheet
Dim strCopy As String
Set wrk = ActiveSheet
For i = 1 To 2
Shell ("COMMAND.COM /C mkdir c:\test\" & wrk.Cells(i, "A"))
strCopy = "COMMAND.COM /C copy c:\" & wrk.Cells(i, "A") & ".xls c:\test\" & wrk.Cells(i, "A")
Shell (strCopy)
Next i

Exit_CreateFolders:
Exit Sub

Err_CreateFolders:
MsgBox Err.Description
Resume Exit_CreateFolders
End Sub


The attach code screwed up the formatting of the code worse than just pasting it into the message body.
 
Klin - Any reason you chose the command.com way instead of the built in vb function mkdir? I have never seen command.com used like that.
 
Personally I'd do it without writing a program:

1) dir *.xls /b > createdir.txt
2) use an editor with regex support (such as NoteTab Plus) and open createdir.txt
3) Use this regex setup:
Find: {\d+}.xls
Replacement: mkdir \1 \nmove \1.xls \1
4) rename createdir.txt createdir.bat
5) createdir.bat

Except for steps 2 and 3, run them from a command line... you're done. This will also move all of the files into their respective folder. Make sure you navigate to the folder where the files are first or it won't work 😛.

EDIT: Silly me using linux commands 😛.
 
Originally posted by: Evadman
Klin - Any reason you chose the command.com way instead of the built in vb function mkdir? I have never seen command.com used like that.

Because I didn't know one existed 😱. Either way works 😀.
 
You call that a quick and dirty solution? Try this at the command prompt:

for %i in (*.xls) do mkdir %~ni & move %i %~ni

😀
 
Originally posted by: Ken_g6
You call that a quick and dirty solution? Try this at the command prompt:

for %i in (*.xls) do mkdir %~ni & move %i %~ni

😀

I'm impressed :thumbsup:.
 
Originally posted by: Ken_g6
You call that a quick and dirty solution? Try this at the command prompt:

for %i in (*.xls) do mkdir %~ni & move %i %~ni

😀

Ahh quicker and dirtier than the smuttiest of smut films! 😉
 
Originally posted by: Ken_g6
You call that a quick and dirty solution? Try this at the command prompt:

for %i in (*.xls) do mkdir %~ni & move %i %~ni

😀

Wow, I didn't think that would work in excel. You win the thread.
 
It's a CLI command, not an Excel command. I didn't realize the Windows CLI could do stuff like that (although I do things like that in bash all the time).
 
I know it was a command line script (assuming that was pointed at me esun), I misunderstood what it was doing until I actually looked at it (bad reading comprehension I think). What that script is doing is creating a folder called the same as the excel document. For some ungodly reason I thought that the OP wanted to create a folder for EACH CELL in an excel document. I thought that script was reading the lines from the excel document and creating directories.

My comment on not being able to do that in excel stems from the fact that I know that the first 16k or so of an excel document is specifically for excel, and the data is later. I thought the script was somehow skipping the header info and reading the data from column A.

I have no idea why I was thinking that, as it is just stupid, and there are a ton of lines missing to even get to reading a file. I'm not saying it can't be done, but it would be a PITA; and is not what is happening in this case anyway. Like I said, I have no idea what was messing with my head on friday, but it did a good job. I will now go hang my head in shame over there --->
 
This is a bit old of a thread but I've modified the CLI script to serve my own purposes, which it does nicely... sort of. What I'm looking for is if I use the CLI script above to instead start an application... what can I do to make it wait until that application is done?

I've been poking around the intarwebz trying to find something, but I've come up short 🙁.

EDIT: Just to clarify, at this point it starts multiple (and by multiple I mean a lot) instances of the application at once, but I want to do one at a time.
 
Hmm couldn't get it to work right and it ended up messing up the original CLI command. I'll probably have to either kill my machine with each run of the script or just write a script to run the script 😛.
 
Back
Top