Reading one of my friend’s blog the other day i stumbled onto this title: “How to copy Multiple Files/Folder names in bulk to Notepad file“. I remember my self wanting to write a small app that would do that exact thing because i needed it a couple of times. At that time i decided not to waste any time on it since i thought that no one would need it actualy. But reading this post i was convinced i should write it since it could be usefull. It took me about an hour and here is what i came up with.
This application actualy lists the contents of a given folder (recursivly or not) into a plain text file or into an EXCEL spreadsheet. I know that those commercial software do a bit more but i think it’s just to show off without any meaning what so ever. To run this small application you need the Java Runtime Environment 6 or better (with older version it won’t work because i used 6 to compile it). You can get the JSE6 here.
There are two batch files included. The first one is called “recompile.bat” which actualy recompiles the source. You should need this if you have an older Java version. The other one is called “run.bat” which actualy runs the program (provided that you have JSE6 available). Running with this bat is actually the interactive mode where the program will ask you questions on what you need. You can run the program to produce the output directly by passing in the options like this “java FileExporter folder recursive excludeFolders xlsOutput showSize showModified outputFile“. Let’s take a quick look on each one of them:
- folder: The folder to start scanning from. It can be either relative (for instance “.”) or absolute (like “c:\”).
- recursive: The values can be “true” or “false”. This indicates whether to perform a recursive search or not. Be careful though, if you order a recursive search on “c:\” for instance this could take A LOT of time (and for many sub-folders the program could crash). This is because i didn’t optimize it for big recursive search.
- excludeFolders: Indicate either to exclude the folders themselves from the list or not. For instance if you have a sub-folder called “foo” and in there more files, do you want “foo” to appear on the list or not? Values can be “true” or “false”.
- xlsOutput: Either export on excel format or text. Values can be “true” or “false”.
- showSize: Add a column with the file size or not. Values can be “true” or “false”.
- showModified: Show the last modified date or not. Values can be “true” or “false”.
- outputFile: The file to output the result. For your convenience if you choose to output on excel name the file with an “.xls” on the end or if you want to export on text then add “.txt”.
You can download the program here: