Skip to main content

Finding similar dot extension files through python script.

Guys ,
      I was studying a book named accidental billioners and found how Zuckerberg sir had hacked university sites and found the whole data. But the problem he found that it was very large data how he will be able to find all the images at one place. Then he thought of an python script. He wrote and execute it then he found all the JPEG, PNG or other image files at one place. I dont know in details how he did that. But I have a python script that shows you all your files in particular directory and with particular extension. here it is.
 
import glob, oss

for root, dirs, files in os.walk("E:\\"):
    for file in files:
        if file.endswith(".txt"):
             print(os.path.join(root, file))
Save this file on notepad by putting dot ".py"extension.


For testing- 
1- Obviously you will need python which you can download from- Python org

2- You need to store path variable if you are using windows. 

3- Then You'll need to start 'cmd'. then write your file path where you have save your python file. Suppose I have saved my file in C:\user\NST>
and I have save its name- search1.py 
then it will look something like this- 

When you will click 'enter' button you will get results like this.

If you want to search some other extensions then  in this statement "if file.endswith(".txt"):" replace '.txt' with the file extension you want to search and you will find similar extension files address.


Comments

Popular posts from this blog

Wallflower's Diary 1

I like people laughing. I like people smiling. I like everyone around me to stay happy. It bothers me most of time when I see anyone struggling with their fate. Usually its hard to keep everyone happy. But It is possible to keep them satisfied. satisfy every one by truth and right that's what I think is an easy task to do.                      It become easy to stay happy when you attach your happiness with others. Then not only you , but everyone around you will help you to keep you happy, cause they will work for keeping themselves happy. World would have a better place without jealousy , money , greed . We all know this still we are unable to detach ourselves with these things. Anyway never stop hoping. Cause that is the only tool we got to face uncertainty of world. We all knows that money is not going to help us fighting with our future problems. May be for a while money will work , but later we need people to help us. Its necessary to be that way. Helping way.            

StartUP

                                               StartUP Here I am Nitin Tiwari again for sharing some of my experience. Well for your kind information I am not that much experienced. I am just 19 years old but as Steve Jobs Sir says that age is irrelevant to experience. You gain experience by mistakes and events you encountered. And age is a thing you cannot control it will keep running until death will put a full stop at the end.                                                                             So this time I am thinking about my start up. I haven't started up yet. I am working under my father right now. But now I do 30 percent of his work, like i look after his shop and his deals of contracts. His PO's and quotations and many more. But I am thinking about starting something my own.                                               As every new young gun feel when he start , I am also very much scared. But It has been my theory to stay scared and nervous, that mea

Activity that connect me with life

I guess, it's a very large topic for me. I would start to explain how anything connect me to life , I can write so many 400 pages books on it. Each activity connect us to the life, but the question is which one connect you more depth. Which one take you to peak of happiness. So I think the topic should be named " One activity that separate you from your life. One Activity that takes your mind away from everything that is connected to the life." When you feel that you don't belong to this world anymore. I think that kind of activity we should  discuss.                                               Well now as I mentioned that each activity made by me connect me with life. I want to explain how, and this answer will answer the other question too. In simple words, I am going to answer two of the questions simultaneously. 1- One activity that connect you to the life?. 2- One activity that takes you away from the world and life?.