| 1. |
Solve : can anyone help me with the lists?? |
|
Answer» Hi, i want to write a program in which a list is to be appended with a new element The SECOND example provided should have produced the desired output. Please EXPLAIN in more detail what result you're looking for. 8-)Thank u for the response.. I want all the files in the folder to be in that list. do that i can PROCESS the list using a for LOOP later. I have tried the second example also..but still i'm getting the same result. If not this is there any other method to get all the files in the directory in a list. Quote A for loop can run a command allowing you to process each file individually. A simple example would be: Code: [Select]for /f "tokens=* delims=" %%i in ('dir /b') do echo %%i Your method of creating a single string with all the file names will create problems should any of the file names have emedded spaces. Need more info to give you a definitive answer, for example do you need the full paths of the files, or what about sub-directories and what do you need to do with this list? 8-)The actual THING that i want to do with the code is that i have a folder which has some sub-folders. each sub-folder has some files. i want to write filenames(with path) of all the files in sub-folders in a file. So,i wanted to add all the sub-folders to a list. then i want to process each of the element in the list(each subfolder name) to get the files in them and write the names in an output file. for this i wanted to get a listYou just want a list with all the (sub)folders and files with path in a textfile which you can read out later? dir /s /b >list.txt hope it helps uli @Sidewinder: NT icludes "setlocal".Thank u...It's almost working... Ok...can u tell me how to add the subdirectories to the list? Isn't there a method to make a list other than using set list = !list! %%i i'm not able to get the expected result even after using setlocal enabledelayedexpansion Quote i want to write filenames(with path) of all the files in sub-folders in a file. This could be done with multiple for instructions, but the dir command has recursion built in: dir /a:-d /s /b >list.txt setlocal enabledelayedexpansion "is useful for getting around the limitations of the current expansion which happens when a line of text is read, not when it is executed". Microsoft Command Line Help 8-) thank u for the response...It's giving the output that i wanted... I have some more questions. I'm still in learning stage.Please be patient. Are there lists in DOS?If yes how to use them? how to append an element to the list? is there any way to remove an element from a list? |
|