Question about simple script?

U

UserMane

Guest
Hello,

I would like to write a small program/script and am looking for advice on how to do so. I do not have a preference about which method or language to use, hopefully looking for the simplest way to do this.

I have a program that runs on text files e.g. "program file1.txt file2.txt"

I have 20 folders that each have 5-10 text files. I want to automatically get the name of the largest size text file from each of the 20 folders, and then run the program on these 20 files as described above.

Ideally I could point my script to a folder, and it will automatically find the largest .txt file in each of the subdirectories and run "program file1.txt file2.txt file3.txt ..."

Any ideas on how to most efficiently accomplish this? Ideas or links to tutorials if applicable are helpful.

Thank you
 


This isn't for school. What I am doing now is File -> Open and selecting one file from each folder about 25 times when I run the program, and I thought this seems like something that could be automated relatively easily.

It has been a while since I have done any programming and I am thinking about getting back into it. This could be a script using bash, python, or a program in C++ that would run in dos/windows.

I am looking for potential ideas or tips as to which commands to use. I understand 'search or read the tutorials' is appropriate but a point in the right direction would be helpful.
 
If I have understood your question correctly, then you might want to check out this link to a post, on stack overflow.
Hope it helps....

OK since im a new member i cannot post links yet, so if you google "bash commad to retrieve largest file from folder"

it should be the first link
 

Members online


Latest posts

Top