I Created an Automatic Folder Cleaner in Python

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 285

  • @KushNamdev
    @KushNamdev 4 роки тому +38

    Everybody knows Harry is the best 👩‍💻😎

  • @santoshkumarpatro3691
    @santoshkumarpatro3691 4 роки тому +10

    I did a similar project in my inter-college hackathon in python and won the first prize......
    I also used OMDB api and tried to sort the films according to the genre and place it in respective genre folder inside a video folder.....
    Also used a simple progress bar in command line to show the status.....
    It was considered one of the unique project of all in that hackathon...
    Glad to see similar project in your channel 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

  • @motorcircle
    @motorcircle 4 роки тому +2

    You are the best guru ji in technical Field

  • @yashedits224
    @yashedits224 2 роки тому +1

    Unique way of teaching.. Best teacher i have ever got.

  • @CodedRealityXR
    @CodedRealityXR 4 роки тому +41

    Sir please bring a course on Data Structures and Algorithms.

  • @devanshkhandelwal6722
    @devanshkhandelwal6722 4 роки тому +26

    Mom - Mera beta bina code copy kiye coding karta h!!
    Modiji - codewithharry wala h kya?

  • @JainishLimbachiya
    @JainishLimbachiya 4 роки тому +2

    Thank you harry bhai 🤗🤗

  • @abhishekjha2087
    @abhishekjha2087 4 роки тому +6

    What a intelligent you are man👏

  • @KshitizAgain
    @KshitizAgain 4 роки тому +20

    Keep It Up! Love you❤️ You are inspiraton to All Programmers! Specially Python!

  • @PROTECHRAHUL
    @PROTECHRAHUL 4 роки тому +2

    Sabse acha UA-cam channel hindi me
    😍😍😍😍😍😍😍

  • @technicaltutorialarena
    @technicaltutorialarena 4 роки тому +1

    Ab tak Mera sabse favorite video.
    Thanks to make it Harry bro 🤘🤘😎😊🙏

  • @PiyushSingh-ut8vu
    @PiyushSingh-ut8vu 4 роки тому +4

    It's really helpful for all of us.I have been looking to do this kinda work using python but not able to execute it properly..Thank u so much for this one❤️🙏

  • @GeekyShubhamSharma
    @GeekyShubhamSharma 4 роки тому +4

    I like this ♥️♥️♥️♥️♥️♥️♥️dedo
    Harry bhai dil se saari videos dekhta hu

  • @rayhann9780
    @rayhann9780 3 роки тому +2

    08:20
    imgExts = [".png", ".jpg",]
    images = [file for file in files if os.path.splitext(file)[1].lower() in imgExts ]
    Bro yahan pe [1] iska kya use hai???

    • @PriyanshuSingh-qj7jz
      @PriyanshuSingh-qj7jz 3 роки тому +2

      @ROYAL GAMING bhai vo.jpg,. png wale part ko detect karne ke liye likha hai kuki indexing 0 se start hoti hai agar vo nhi likhte to vo pure file ko le leta is liye sirf . Wala part categorize karne ke liye 1 index ka use kiya hai

    • @rayhann9780
      @rayhann9780 3 роки тому +1

      @@PriyanshuSingh-qj7jz ohhh okay

  • @RahulKumar-wz1gz
    @RahulKumar-wz1gz 4 роки тому +1

    sir you are genius. sir apka or mera favorite hain python.

  • @engineerbhai7642
    @engineerbhai7642 4 роки тому +1

    No words to appreciate your hard work and talent. You deserve million subscribers.

  • @freedomsfreeway3501
    @freedomsfreeway3501 4 роки тому

    I donot have word to speak something. You are great. god bless you. You are the real hero for me. Thanks sir.

  • @bhanwarchoudhary3521
    @bhanwarchoudhary3521 4 роки тому +1

    harry bhai beginners series follow kr rha hu lockdown khulne tk python expert ban jayuga thank you , luv you bro

  • @LovishXD
    @LovishXD 4 роки тому +2

    thnx for project idea for me during lockdown

  • @krishnapoddar76
    @krishnapoddar76 4 роки тому +1

    harry bhai pls pls kivy course

  • @vasugarg2293
    @vasugarg2293 4 роки тому +1

    Same thing can be achieved using the following code. I have also used shutil module and tried to make the code simpler. Also added the count feature which will count the number of files organised. Please check the code.
    import os
    import shutil
    def createIfNotExist(folder):
    if not os.path.exists(folder):
    os.mkdir(folder)
    def fileExtChecker(list):
    if (file.lower().endswith(list)):
    return file

    files = os.listdir()
    files.remove("auto.py")
    createIfNotExist("Images")
    createIfNotExist("Docs")
    createIfNotExist("Media")
    createIfNotExist("Other")
    imgExts = ('.png', '.jpg', '.jpeg','.bmp')
    docExts = ('.pdf', '.doc', '.docx', '.xlsx', '.pub')
    mediaExts = ('.mp4', '.mp3')
    for file in files:
    if(fileExtChecker(imgExts)):
    images = file
    shutil.move(images,'Images')
    elif(fileExtChecker(docExts)):
    docs = file
    shutil.move(docs,'Docs')

    elif(fileExtChecker(mediaExts)):
    media = file
    shutil.move(media,'Media')

    else:
    other = file
    shutil.move(other,'Other')



    print(f"Organised {len(files)} total files
    ")

  • @mohammadsufiyannafis7772
    @mohammadsufiyannafis7772 4 роки тому

    Mazedaaar harry bhai. Zaroor try karunga. Harry bhai aesehi please aur bhi mini projects laate rahiye achi practice horahi he

  • @sayandipghosh4465
    @sayandipghosh4465 4 роки тому +1

    Love for Python series

  • @krishnaaggarwal2799
    @krishnaaggarwal2799 4 роки тому +1

    It's actually very useful for people like me who keep their stuff really unmanaged

  • @Rohan-oz6fq
    @Rohan-oz6fq 4 роки тому

    Jahapana tussi great ho... salaam qubool karo!!!

  • @abhishekkhatana1256
    @abhishekkhatana1256 4 роки тому +2

    yes sir plzzz bring a course
    on data structures and algorithms

  • @Yatri_hu_yaaro
    @Yatri_hu_yaaro 4 роки тому +1

    How to get this code?? Or we have to write??

  • @shubhamtodkar8078
    @shubhamtodkar8078 4 роки тому +3

    Bhai plz REACT JS par information dijiye

  • @nilimaarghode7805
    @nilimaarghode7805 4 роки тому

    Harry sir mai 11 saal ka hu, sir maine agar HTML5 aur css3 sikha hai to sirf apse sir, really salute to you harry sir, please comment me

  • @mayurgoyal9858
    @mayurgoyal9858 4 роки тому

    Very helpful Thank you Harry bhai

  • @hardikpatel2021-o3d
    @hardikpatel2021-o3d 4 роки тому +1

    Pirogremer(stonk meme) 😂😂😂 just a fun, you are too talented man

  • @jagdishjaggu3261
    @jagdishjaggu3261 4 роки тому

    Harry bhaiya mene jarvis AI banaya and i am 13 years old
    And its works
    Thanks Bhai
    Bestest programmer i ever seen
    Love u ❤

  • @protomansion5574
    @protomansion5574 4 роки тому +2

    Bhai you are a genius. You created an option level thing. Great Bhai Heart bhi chahiye

  • @abhai2005
    @abhai2005 4 роки тому

    Bhai I am 11 years old and your videos are great , you should deserve millions of subscribers.

  • @articlenex
    @articlenex 4 роки тому

    Sabko ik ik dil. Melga meri tarse matal Hari bhai ❤️

  • @amvutopia
    @amvutopia 4 роки тому +1

    Aapke python tutorials maine abhi abhi dekhni start ki hai aur kasam se mujhe bohot maja aa raha hai.
    Aapke playlist me aapne exercise 5 me Health Management system diya tha shayad aapko yaad hoga.
    Meri request hai aap ekbaar mera bhi check kar dijiyena please..... And please tell if I can improve it anyway😊😊
    ❤❤❤❤❤❤❤
    code starts here👇
    """
    Hi I am Ritik Kujur and I am watching your python tutorials.
    Aapko shukriya kehna chahta hun, aap bohot achha samjhate hai.
    Please bataiye mera banaya hua progam kaisa hai.
    Ye sab maine aap se hi seekha hai
    ye line "return datetime.datetime.now().strftime("%D.%H.%M")" maine jarvis video me seekha tha isliye yaha use kar liya
    Aur wo bracets experiments kar ke pata kiye ki aisa bhi hota hai
    Thanks!!
    """
    open("Harry exercise.txt", 'x')
    open("Harry diet.txt", 'x')
    open("Rohan exercise.txt", 'x')
    open("Rohan diet.txt", 'x')
    open("Hammad exercise.txt", 'x')
    open("Hammad diet.txt", 'x')
    import os
    def getdate():
    import datetime
    return datetime.datetime.now().strftime("[%D].[%H.%M]")
    def management():
    print("Welcome to Health Management")
    print("What do you want to do?")
    print("1.lock")
    print("2.Retreive")
    print("(Anser in 1 or 2)")
    choice = input("your operation: ")

    if choice == '1':
    print(" 1.Harry
    ", "2.Rohan
    ", "3.Hammad")
    client = input("Choose the client: ")
    if client == '1':
    print(" 1.Exercise
    ", "2.Diet")
    task = input("Choose your task: ")
    if task == '1':
    with open("Harry exercise.txt", 'r+') as f:
    print(f.read())
    exercise = input("Which exercise you did or want to do? ")
    f.write("
    ")
    f.write(getdate())
    f.write( exercise)
    print("OK, progress saved!!")
    elif task == '2':
    with open("Harry diet.txt", 'r+') as f:
    print(f.read())
    diet = input("What diet you had? ")
    f.write("
    ")
    f.write(getdate())
    f.write( diet)
    print("OK, progress saved!!")
    else:
    print("Check your input")

    if client == '2':
    print(" 1.Exercise
    ", "2.Diet")
    task = input("Choose your task: ")
    if task == '1':
    with open("Rohan exercise.txt", 'r+') as f:
    print(f.read())
    exercise = input("Which exercise you did or want to do? ")
    f.write("
    ")
    f.write(getdate())
    f.write( exercise)
    print("OK, progress saved!!")
    elif task == '2':
    with open("Rohan diet.txt", 'r+') as f:
    print(f.read())
    diet = input("What diet you had? ")
    f.write("
    ")
    f.write(getdate())
    f.write( diet)
    print("OK, progress saved!!")
    else:
    print("Check your input: ")

    if client == '3':
    print(" 1.Exercise
    ", "2.Diet")
    task = input("Choose your task: ")

    if task == '1':
    with open("Hammad exercise.txt", 'r+') as f:
    print(f.read())
    exercise = input("Which exercise you did or want to do? ")
    f.write("
    ")
    f.write(getdate())
    f.write( exercise)
    print("OK, progress saved!!")
    if task == '2':
    with open("Hammad diet.txt", 'r+') as f:
    print(f.read())
    diet = input("What diet you had? ")
    f.write("
    ")
    f.write(getdate())
    f.write( diet)
    print("OK, progress saved!!")
    else:
    print("Check your input: ")
    back = input("Do you want to return to menu?")
    back = list(back)
    if 'e' in back:
    management()
    if 'o' in back:
    print("See ya!!")
    elif choice == '2':
    print(" 1.Harry
    ", "2.Rohan
    ", "3.Hammad")
    client = input("Choose the client: ")
    if client == '1':
    print(" 1.Exercise
    ", "2.Diet")
    task = input("Choose your task: ")
    if task == '1':
    f = open("Harry exercise.txt", 'r')
    content = f.read()
    print(content)
    f.close()
    elif task == '2':
    f = open("Harry diet.txt", 'r')
    content = f.read()
    print(content)
    f.close()
    else:
    print("Check your input")
    elif client == '2':
    print(" 1.Exercise
    ", "2.Diet")
    task = input("Choose your task: ")
    if task == '1':
    f = open("Rohan exercise.txt", 'r')
    content = f.read()
    print(content)
    f.close()
    if task == '2':
    f = open("Rohan diet.txt", 'r')
    content = f.read()
    print(content)
    f.close()
    else:
    print("Check your input")
    elif client == '3':
    print(" 1.Exercise
    ", "2.Diet")
    task = input("Choose your task: ")
    if task == '1':
    f = open("Hammad exercise.txt", 'r')
    content = f.read()
    print(content)
    f.close()
    if task == '2':
    f = open("Hammad diet.txt", 'r')
    content = f.read()
    print(content)
    f.close()
    else:
    print("Check your input")
    else:
    print("Check your input")
    back = input("Do you want to return to menu?")
    back = list(back)
    if 'e' in back:
    management()
    if 'o' in back:
    print("See ya!")
    management()

  • @rishantkarn5384
    @rishantkarn5384 2 роки тому

    4:31 I have a question, can we use os.mkdir()

  • @articlenex
    @articlenex 4 роки тому +1

    Ap kaha rehate hoo Harry bhai apse milena hai lockdown ke badha apka fan banagaya huu Hari bhai

  • @mubashar-nouman
    @mubashar-nouman 4 роки тому

    Harry bhai please carry on this playlist

  • @tejasjani2544
    @tejasjani2544 4 роки тому +1

    Love you sir 😇

  • @apoorvashukla3344
    @apoorvashukla3344 4 роки тому

    Superb video sir👌👌

  • @codewithalfin
    @codewithalfin 4 роки тому

    Harry Bhai Love You Brother From Bangladesh 😍 I have been following you for the last 6 months, You are my role model.

  • @dhruvnation1884
    @dhruvnation1884 4 роки тому

    nice keep up this good work mr haris.ali.khan.good work

  • @adityakumbhar7777
    @adityakumbhar7777 4 роки тому

    I needed this thanks bro ❤👍

  • @avizyt_official
    @avizyt_official 3 роки тому

    Thank for a nice simple but very effective project.

  • @ryadav9641
    @ryadav9641 2 роки тому

    Awesome project knowledge and very useful code 😅

  • @NitinKumar-qk1fi
    @NitinKumar-qk1fi 4 роки тому

    You really best 👍💯 at this

  • @GhostCoder83
    @GhostCoder83 4 роки тому

    best part is where how we can use various modules and their functionality through searching on web. Thanks sir.

  • @DScuber-zh3gh
    @DScuber-zh3gh 4 роки тому

    bhai you are awesome please make a video on your setup and pc specs

  • @ankitkumargupta9753
    @ankitkumargupta9753 4 роки тому

    awesome bro excellent work
    what a unique application of python
    Great work👍👍

  • @dharmeshsewarik4371
    @dharmeshsewarik4371 4 роки тому +1

    Also complete machine learning by adding face recognition and other things

  • @binaydubey7275
    @binaydubey7275 4 роки тому

    can u please please tell me which software u use to record to ur screen

  • @SourashmiDas
    @SourashmiDas Рік тому

    why [1] is given after splitext means is it syntax? or any specific reason for that?

  • @prashantpanchal1303
    @prashantpanchal1303 4 роки тому

    Bro . Jo Aapne machine learning ka tutorial banaya tha usme marplotlib me attribute error or module no define or many error as the hai .
    Why

  • @technicaljafar
    @technicaljafar 4 роки тому

    Great 👍

  • @biswajitdebnath2041
    @biswajitdebnath2041 4 роки тому +1

    Harry bhai, kya hum c programme ko use karke chatbot bana sakte hai??

  • @tstar5375
    @tstar5375 4 роки тому

    Good job sir... 👍

  • @mohdadil2875
    @mohdadil2875 4 роки тому

    congratulation harry bhaii subscriber speed 2k/per day

  • @lakshkumrawat140
    @lakshkumrawat140 4 роки тому +1

    I like it😁😁

  • @manojarajaram529
    @manojarajaram529 4 роки тому

    harry bhai, Do more content like this

  • @thatsnotsukritya
    @thatsnotsukritya 4 роки тому +1

    Harry bhai, your course on web development is just amazing.
    Please tell if I will be able to design beautiful websites after doing that course??

    • @CodeWithHarry
      @CodeWithHarry  4 роки тому

      Yes, definitely

    • @satyabrotagoswami6785
      @satyabrotagoswami6785 4 роки тому

      @@CodeWithHarry bhai react.js ke Upar video series banao.....plz

    • @thatsnotsukritya
      @thatsnotsukritya 4 роки тому

      @@CodeWithHarry Thanks for your reply sir!!
      I am very grateful to receive reply from such a great personality.

    • @subhsinghania7580
      @subhsinghania7580 4 роки тому

      @@CodeWithHarry vo course mai aur banaiye na plz..

  • @jimcheriyan1801
    @jimcheriyan1801 4 роки тому

    Harry Sir is the best

  • @rishabhtiwari1153
    @rishabhtiwari1153 4 роки тому +1

    Bhai python se data structures and algorithms ka course laa do

  • @ankitdhanare2634
    @ankitdhanare2634 4 роки тому +1

    Sir how to learn to build Android roms or gsi image????

  • @jwolverine10
    @jwolverine10 4 роки тому +1

    If we code for folder selection in this code, i think it will eliminate the process to copy main.py in each path.

  • @prashantpanchal1303
    @prashantpanchal1303 4 роки тому

    Aapne usme python 3.7.1 use Kiya hai or pucharm 2018 but 2020 updated version me bhut error aa rhe hai. Koi bhi program run nhi hi rha hai. Kya kre ?
    Prashant Panchal

  • @theinfo6904
    @theinfo6904 4 роки тому

    You are the best proggeammer

  • @adityakumbhar7777
    @adityakumbhar7777 4 роки тому +1

    bro i am confused between pycharm and vs code please suggest me!!!!

  • @rajakushwah9940
    @rajakushwah9940 4 роки тому +1

    I am getting permission error [ win error 5 ] access is denied.
    I try to run the script through administrator but it is not working. Please try to help me here.

  • @prashantmajumdar1519
    @prashantmajumdar1519 4 роки тому

    Harry bhai please complete the c++ series

  • @programmer4047
    @programmer4047 4 роки тому

    Instead of using *If Statement* at 5:30 you can use *exist_ok=True*

  • @dhanrajdarshitshetty5046
    @dhanrajdarshitshetty5046 4 роки тому

    You are a genius!!!

  • @neerajchandhiok3174
    @neerajchandhiok3174 4 роки тому

    hi, Disha here.
    I am doing python by ur beginner python course.
    I am confused in an exercise given by you.Its a pyramid problem. Kindly check it and reply too.
    n=int(input("enter n:"))
    p=input("enter ch")
    if p=='t' :
    for i in range(1,n+1,1):
    for j in range(i):
    print("*",end="")
    print()
    elif p=='f':
    for i in range(n,0,-1):
    for j in range(i):
    print("*",end="")
    print()

  • @ANKITSINGH-pi2zi
    @ANKITSINGH-pi2zi 4 роки тому

    It's just an amazing python project .your explanation was so interesting and easy to understand everyone. Great job 👏👏👏

  • @pialhalder985
    @pialhalder985 Рік тому

    hey harry! I did this project bt in my way :D my code is:
    import os
    def create_if_doesnt_exist(folder):
    # A function to create a folder if it doesn't exist already
    if not os.path.exists(folder):
    os.makedirs(folder)
    def move(foldername, files):
    # A function to move the files to the folder it belongs.
    for file in files:
    os.replace(file, f"{foldername}/{file}")
    def take_file_extension(exts):
    # a function to get the file extension
    return [file for file in files if os.path.splitext(file)[1].lower() in exts]
    files = os.listdir() # taking the file names in a list
    files.remove("Automatic Folder cleaner.py")
    imgExts = [".png", ".jpg", ".jpeg"]
    images = take_file_extension(exts=imgExts)
    docExts = [".txt", ".docx", ".doc", ".pdf"]
    documents = take_file_extension(exts=docExts)
    torrExts = [".torrent"]
    torrents = take_file_extension(exts=torrExts)
    # taking the files according to their extensions. extensions are registered in a list
    create_if_doesnt_exist('images')
    create_if_doesnt_exist('docs')
    create_if_doesnt_exist('torrents')
    create_if_doesnt_exist('others')
    others = []
    for file in files:
    ext = os.path.splitext(file)[1].lower()
    if (ext not in imgExts) and (ext not in docExts) and (ext not in torrExts):
    others.append(file)
    move("images", images)
    move("docs", documents)
    move("torrents", torrents)
    move("others", others)

  • @rahulbarman1018
    @rahulbarman1018 3 роки тому

    While moving into another folder using function I am facing this error" TypeError: replace: src should be string, bytes or os.PathLike, not list". But if I do it manually without using move function then it's fine . What should I do ?

  • @avknash175
    @avknash175 4 роки тому +1

    Bhai FLUTTER ki tutorial leke aao

  • @mdneazali8557
    @mdneazali8557 3 роки тому

    Thank you so much
    You always make videos which are good for us to easily understand

  • @amazecreations1853
    @amazecreations1853 4 роки тому +1

    Harry Bhai , ap ka Shaktiman wala intro dalo new video me , swayang Mukesh Khanna vi Sharma jayega

  • @001abdulrahman2
    @001abdulrahman2 4 роки тому

    Harry Bhai jb se aap ka channel Mila hai mujhe 4 month me zero se hero ho gya hu

  • @buddhapriyaborkar389
    @buddhapriyaborkar389 4 роки тому

    Harry bhaiya/sir you are best;
    By the way
    I am learning c from your videos 💙 ;

  • @D4rkH4ck3r5
    @D4rkH4ck3r5 4 роки тому

    you arebthe best sir

  • @amitbehera9850
    @amitbehera9850 4 роки тому

    Awesome Harry bhai

  • @angstudio7642
    @angstudio7642 4 роки тому

    Wow sir really amazing content .
    I ansh
    From Haryana

  • @ManishSharma-fi2vr
    @ManishSharma-fi2vr 4 роки тому

    Good good sir..lage rahoo

  • @RAUSHANSINGH007
    @RAUSHANSINGH007 4 роки тому

    Harry sir, please make more video of this kind regarding real life industry production based video using python

  • @iDeviceSlash
    @iDeviceSlash 4 роки тому

    thankyou bhai

  • @jimcheriyan1801
    @jimcheriyan1801 4 роки тому

    Thanks a lot Harry

  • @adityasadhukhan8438
    @adityasadhukhan8438 4 роки тому

    How does a server machine get logs of ip addresses of clients which connect to server

  • @princepatel0098
    @princepatel0098 4 роки тому

    Amazing bro.....its run

  • @mohammadumair5239
    @mohammadumair5239 4 роки тому +1

    Hello bro
    I'm new in your channel.....?
    I'm confused.......
    Which language is best to learn to make a Computer Operating System.......?
    Can you help me please which language . I learned to make an operating system.
    Please bro please help me

  • @VC-dm7jp
    @VC-dm7jp 3 роки тому

    Great project

  • @AadyashaNews
    @AadyashaNews 4 роки тому +1

    hi sir i am your big fan plz reply me

  • @prtsdeepworld3103
    @prtsdeepworld3103 4 роки тому

    Bhai apki website pe contact me waala option kaam nahi kar raha, aapko contact karna tha, nahi ho raha

  • @iShubhamPanchal
    @iShubhamPanchal 4 роки тому +1

    Sir, ds algo for beginners to advance

  • @vinayprajapati8386
    @vinayprajapati8386 4 роки тому

    Mere program me media folder me media files nahi ja rahi hai aur error message de raha hai - " replace: src should be string,bytes or is. PathLike , not list" ye error aa raha hai

  • @97pogo
    @97pogo 4 роки тому

    pls make other projects using python like this pls

  • @ashishmaheshwari318
    @ashishmaheshwari318 3 роки тому

    How can we make subfolders inside a folder which is made using os module so that our folders can be segregated more deeply?

  • @anilbhardwaj856
    @anilbhardwaj856 4 роки тому

    Harry bhai jai ho python ki jai ho

  • @Bharattechvlog
    @Bharattechvlog 4 роки тому

    New version Android studio me quzis type app सिखाईए plz.....