Does there exist a DOS command that will result in a text file:
a) containing a list of the contents of a folder specified in the DOS command, preferably distinguishing between files and subfolders, and
b) saved as & at a specified name and path, e.g., C:\WINDOWS\DESKTOP\List.txt
–?
Somewhere in the dim, seldom-dusted nether reaches of my mind, I have a vague recollection of having once known how to do this. I could, of course, be wrong.
OH YEAH: If you know it, please be patient and highly specific in your instructions. I’m a Mac user and DOS commands that are chock full of “switches” always intimidate the hell out of me.
dir c:\folder*.* /s /-v > C:\windows\desktop\list.txt
You want the -v switch in there so it doesn’t ask you to hit enter every time it needs to scroll a page off the top of the screen. This is particularly obnoxious when the prompt to do so is being redirected to a file.
ultrafilter, I’m not sure what you mean; if you enter the command as I (re)typed it, you should see nothing on screen until you get the next blinking cursor.
beatle: It might depend on what version of DOS you’re using. I’d go out and look it up, but I’m using win2k, and I can’t find the DOS prompt. Over the summer, I had to do what I described to get this to work properly.
(I used ultrafilter’s version; others may work equally well)
I have a FileMaker solution for my girlfriend which calculates the DOS command from an initial folder path she enters, exports it as a batch file, runs it, imports the resultant text file, parses it, and thereby has the names, sizes, modification dates, and modification times of all files in the selected folder.
(All because she has not had good luck with any of TUCOWS’s synchronization programs so I’m writing her one in FileMaker, if you’re curious)
“command > file.txt” means direct the output from command to file.txt, creating file.txt if it does not exist and overwriting file.txt if it already exists.
“command >> file.txt” means direct the output from command to file.txt, creating file.txt if it does not exist and appending to file.txt if it already exists.
These work in all versions of DOS I’ve used (so all the modern ones) and every *nix shell I’ve used (sh, csh, bash, tsh and ksh) so presumably it works in all of them.