I set up a simple batch file in windows to create a file that lists the names of all files in a folder. I added it to the action list for folders so I can run this on any folder at any time. Here is the code from my batch file:
@echo off
dir %1 /-p /b /o:gn >File-List.txt
exit
Is there any way that I can add the folder name to the beginning of the created file name? IE if I run this on a folder "Downloads" the resulting file name would be "Downloads-File-List.txt"
I use this forum for everything else, so I hope someone can help. Or if someone knows a better forum to post this type of question please let me know.
I wanna devise a virus and bring dire straights to your environments. Crush your corporations with a mild touch, trash the whole computer systems and revert you to papyrus - Deltron 3030
It's easy but I can't remember exactly how.. you need to get the directory name, and assign it to $dir_name.. then cd to the working directory, run your batchfile and output >$dir_name File-List.txt
or have I got confused with C++ ?? It's been a really long time since I did and dos batchfile stuff... There are books and guides all over the place about dos batchfile functions.. I do know you don't need anything like visual basic to do this... because we were doing it long before there was such a thing.
Quote:I do know you don't need anything like visual basic to do this... because we were doing it long before there was such a thing.
The challenge though is that he added it to his "action menu" which I believe he means when he right clicks on a folder he wants to run it from there. Last I remembered there wasn't too much right clicking going on in DOS
I am trying to do this by just running the batch file. I am assuming that any dos commands would just need to be added to this .bat file. I only added it to the action menu to make it simpler.
I wanna devise a virus and bring dire straights to your environments. Crush your corporations with a mild touch, trash the whole computer systems and revert you to papyrus - Deltron 3030
Thanks seb32! That link and another tip on that site got me part of the way. I started tweaking some of the code they had and figured out that it was easier than I thought. All I had to do was replace File-List with %1 and it worked. Here is the new code.
@echo off
dir %1 /-p /b /o:gn >%1%.txt
exit
Now all I have to do is right click on a folder and use the action, "Create File List", that I created and I get a .txt file that lists all the files that are in that folder.
Man, I love this site. Even if you don't get the exact answer you need someone is bound to get you close. Thanks again everyone who replied, and everyone who ever has helped someone on this site.
I wanna devise a virus and bring dire straights to your environments. Crush your corporations with a mild touch, trash the whole computer systems and revert you to papyrus - Deltron 3030