General Question

XOIIO's avatar

Is there a batch command to type flename to a document?

Asked by XOIIO (18328points) November 30th, 2010 from iPhone

I know how to use the type commands, how can I use it to type (*.zip for example) but it needs to be the variable filename in that directory.

Observing members: 0 Composing members: 0

8 Answers

lillycoyote's avatar

Maybe it’s just me but it’s not clear exactly what you want to do, at least to me. You want to end up with a list of files in a document? Like a text document of some sort? That’s the part I don’t get. What exactly are trying to accomplish? What needs to be the variable filename? I guess I don’t get that part either. Maybe I’m just dense but I really don’t understand what you’re trying to do.

XOIIO's avatar

Yeah, this is the line

echo C:\directory\*zip>> C:\directory\log.txt

I want all zip (or other) files in the directory to be send to the text file.

lillycoyote's avatar

I don’t know how to write a batch file to do something like that but I can give you a really easy way to get a text list of all the files of a certain type. There’s a free file search program called Agent Ransack. It’s a great little search utility but you can also get a list of files. If you want a list of zip files or any file by name or file type/extension on your entire drive or any subdirectory do the search. Search for *.zip for example, then go to the file drop down menu and choose Export results and choose text and it will export a list of the files in your search to a text file. The only problem is, if you don’t want the directory name, that it includes the directory name before the file name, but if you are only doing one directory at a time that information is pretty easy to remove.

So, if what you are trying to do is get a text list/inventory of all the files of a certain type in a certain directory, Agent Ransack will do it for you pretty easily.

There probably is a way to do it using a DOS command of some kind but I don’t remember how and this just seems easier to me, particularly if you’re going deeper and deeper into sub-sub-sub directories, that’s always been pretty tedious in DOS.

If I understand what you want to do I think this will allow you to do it with relatively few headaches.

XOIIO's avatar

I’ll check that out, but a dos method would definitely be preferred.

lillycoyote's avatar

O.k. My DOS skills are kind of rusty but I found this. If you scroll down the page and read the comments you will find one from a guy who modified the original command to output to a .txt file only certain file types/file extensions. You should be able to work out what you want from the info from both the original instructions and info from some of the comments.

If not, I’m out of ideas. :-)

Good luck.

ratboy's avatar

dir /b C:\directory\*.zip > C:\directory\log.txt

XOIIO's avatar

@ratboy Brilliant! Works Like a Charm!

How can I get it to display in the CMD instance? echo doesnt work

lillycoyote's avatar

@ratboy Yeah Ratboy!!!!

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther