|
Answer» Any help would be appreciated.
I have a list of filenames in a text file. Sometimes, the list of filenames can be in the thousands. The filenames in the text file all reside in a network folder, however, they are only some of the entire population in that network folder. There are many other files in the network folder, but I only need to get the size attribute or total size of the filenames from the text file.
What is the best way to go about doing this with a batch file?
I have tried some very simple batch files with the commands DIR but it has some limitations. For example, the speed the bat file runs through the list of dir commands in the bat file takes more time than I EXPECTED. Also, there may be filenames in the list that are entirely different files with different file paths, but with the same filename. I need to be able to get the sizes of files that have same names as well.
Anyway this can be done?
Thanks,
Code: [Select]for /f %%A in ('type list.txt') do ( for /f "tokens=3 skip=7" %%1 in ('dir /a:-d %%A') do (echo %%1bytes>>size.txt) ) FBFireballs,
Thanks. It works just fine. Is there any way to improve the speed at which it processes the batch file? Some files contain thousands of filenames and if anything can be done to improve the speed would be nice. Perhaps it is just the way it is.
Thank you Fireballs.I don't believe the code can be made any more efficient but taking on board Dias De Verano's comments on your other topic might increase the speed.
FBFireballs,
In an effort to speed up this process that this batch file does, I was wondering something. Would the script run any faster if we were to add a direct path to the file that we want to figure the size of? COULD we place the path into the list.txt along with the file name? If so, can the script be edited to such that it would only go to the specified path to retrieve the size of that file?
Basically, I can have up to tens of thousands of filenames in the list.txt and the directory they reside may have many many SUBFOLDERS. I think the script is running extra hard to find these files not knowing exactly where they are.
What are you thougts Fireballs?
Thanks.
|