Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • GfG 160: Daily DSA
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
Pathlib module in Python
Next article icon

Pathlib module in Python

Last Updated : 19 Dec, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Pathlib module in Python offers classes and methods to quickly perform the most common tasks involving file system paths, incorporating features from several other standard modules like os.path, glob, shutil, and os.

Path classes in Pathlib module are divided into pure paths and concrete paths. Pure paths provides only computational operations but does not provides I/O operations, while concrete paths inherit from pure paths provides computational as well as I/O operations.

Pathlib-module-classes-relation-diagram

Basic Use of Python Pathlib Module

Python pathlib module provides an object-oriented way to handle filesystem paths. Here’s how we can use it to perform common filesystem operations more efficiently than with the older os and os.path modules.

Importing the Main Class

Before we can use any features of pathlib, we need to import the Path class from the module:

Python
from pathlib import Path

Listing Subdirectories

To list all subdirectories in a directory, we can use the iterdir() method and filter for directories:

Python
from pathlib import Path

p = Path('/')

for subdir in p.iterdir():
    if subdir.is_dir():
        print(subdir)

Output
/media
/root
/run
/home
/sbin
/var
/bin
/mnt
/opt
/lib64
/sys
/lib32
/tmp
/libx32
/usr
/etc
/boot
/proc
/dev
/srv
/lib

Listing Python Source Files in This Directory Tree

We can list all Python files (.py) within a directory and its subdirectories using the rglob() method, which recursively searches through the directory tree:

Python
from pathlib import Path

p = Path('/')

files = p.rglob('*.py')
for f in files:
    print(f)

Output:

\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\abc.py
\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\aifc.py
\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\antigravity.py
\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\argparse.py

Navigating Inside a Directory Tree

We can navigate within a directory tree using the / operator, which is overloaded to construct new Path objects:

Python
sp = p / 'example.txt'
print(sp)

Output:

\example.txt

Querying Path Properties

pathlib allows us to easily check various properties of paths:

Python
# Check if the path is absolute
print("Is absolute:", sp.is_absolute())

# Get the file name
print("File name:", sp.name)

# Get the extension
print("Extension:", sp.suffix)

# Get the parent directory
print("Parent directory:", sp.parent)

Output:

Is absolute: False
File name: example.txt
Extension: .txt
Parent directory: \

Reading and Writing to a File

Opening a file using pathlib is straightforward with the open() method. We can read from or write to files easily:

Python
# Reading from a file
with (path / 'example.txt').open('r') as file:
    content = file.read()
    print(content)

# Writing to a file
with (path / 'output.txt').open('w') as file:
    file.write("Hello, GFG!")

Output:

First line of text.
Second line of text.
Third line of text.

Pure Paths

As stated above, Pure paths provide purely computational operations. Objects of pure path classes provide various methods for path handling operations. Pure path object operates without actually accessing the file system. Pure Path is useful when we just want to manipulate a path and without actually accessing the operating system. We can manipulate a Windows file system path on a Unix machine or vice-versa easily by instantiating one of the pure classes.

class pathlib.PurePath(*pathsegments) :

This class helps us manage paths. It doesn't actually interact with files on our computer but lets us work with path information easily. Upon instantiating this class will create either pathlib.PurePosixPath or pathlib.PureWindowsPath.

Example:

Python
# Import PurePath class
# from pathlib module
from pathlib import PurePath

# Instantiate the PurePath class
obj = PurePath('foo/bar')

# print the instance of PurePath class
print(obj)

Output
foo/bar

class pathlib.PurePosixPath(*pathsegments) :

This is for UNIX-style paths (like those on macOS or Linux). It's not meant for use on Windows.

Python
# Import PurePosixPath class
# from pathlib module
from pathlib import PurePosixPath

# Instantiate the PurePosixPath class
obj = PurePosixPath('foo/bar')

# print the instance of PurePosixPath class
print(obj)

Output
foo/bar

class pathlib.PureWindowsPath(*pathsegments) :

This one is for Windows-style paths. If we are on a Windows computer, this class understands how paths work .

Python
# Import PureWindowsPath class
# from pathlib module
from pathlib import PureWindowsPath

# Instantiate the PureWindowsPath class
obj = PureWindowsPath('foo/bar')

# print the instance of PureWindowsPath class
print(obj)

Output
foo\bar

Below are few methods provided by Pure Path classes:

PurePath.is_absolute() method :

This method is used to check whether the path is absolute or not. This method returns True if the path is absolute otherwise returns False.

  • On Windows, an absolute path would start with a drive letter and a colon, like C:\Users\Username\Documents\file.txt.
  • On UNIX-based systems (like macOS and Linux), it starts with a forward slash (/), such as /home/username/documents/file.txt.
Python
from pathlib import PurePath

# Example of an absolute path
p = PurePath('/user/example/document.txt')
print(p.is_absolute())  

# Example of a relative path
rp = PurePath('document.txt')
print(rp.is_absolute())  

Output
True
False

PurePath.name property :

This feature lets us get the last part of a path, which is usually the file or folder name.

Python
# Python program to explain PurePath.name property

# Import PurePath class from pathlib module
from pathlib import PurePath

# Path
path = '/Desktop/file.txt'

# Instantiate the PurePath class
obj = PurePath(path)

# Get the final path component
comp = obj.name

print(comp)

Output
file.txt

Concrete Paths:

Concrete Paths refer to classes that provide methods for performing operations on the filesystem. These paths are "concrete" because they interact with the actual filesystem, allowing for the execution of file and directory operations such as checking existence, making directories, reading files and more. We can instantiate a concrete path in following three ways:

class pathlib.Path(*pathsegments) :

It represents a path and allows for a variety of methods that interact directly with the filesystem. Depending on the system Python is running on, Path will behave like either PosixPath or WindowsPath.

Python
# Import the Path class
from pathlib import Path

# Instantiate the Path class
obj = Path('/usr/local/bin')

print(obj)

Output
PosixPath('/usr/local/bin')

class pathlib.PosixPath(*pathsegments) :

This class is used specifically in UNIX-like systems (Linux, macOS). It inherits all methods from Path and PurePosixPath. It provides methods for UNIX-specific filesystem interaction.

Note: We can not instantiate pathlib.Posixpath class on Windows operating system.

Python
# Import PosixPath class
# from pathlib module
from pathlib import PosixPath

# Instantiate the PosixPath class
obj = PosixPath('/usr/local/bin')

# Print the instance of PosixPath class
print(obj)

Output
PosixPath('/usr/local/bin')

class pathlib.WindowsPath(*pathsegments) :

This class is used on Windows systems. It inherits from Path and PureWindowsPath, adapting path operations to Windows standards. This includes handling paths with drive letters and backslashes.

Python
# Import WindowsPath class
# from pathlib module
from pathlib import WindowsPath

# Instantiate the WindowsPath class
obj = WindowsPath('C:/Program Files/')

# Print the instance of WindowsPath class
print(obj)

Output
WindowsPath('c:/Program Files/')

Below are few methods provided by Path class:

Path.cwd() method :

This method returns a new path object which represents the current working directory. For instance, calling Path.cwd() will give us the path from where your Python script is executed.

Python
# Import Path class
from pathlib import Path

# Get the current working directory name
dir = Path.cwd()

print(dir)

Output
/home/ihritik

Path.exists() method :

Path.exists() checks whether the specified path exists on the disk. It returns True if the path exists, otherwise False.

Python
# Import Path class
from pathlib import Path

# Path
path = '/home/hrithik/Desktop'

# Instantiate the Path class
obj = Path(path)

# Check if path points to
# an existing file or directory
print(obj.exists())

Output
True

Path.is_dir() method :

This method is used to determine if the path points to a directory. It returns True if the path is a directory, otherwise False.

Python
# Import Path class
from pathlib import Path

# Path
path = '/home/hrithik/Desktop'

# Instantiate the Path class
obj = Path(path)

# Check if path refers to
# directory or not
print(obj.is_dir())

Output
True

Next Article
Pathlib module in Python

I

ihritik
Improve
Article Tags :
  • Python
  • python-utility
  • python-modules
Practice Tags :
  • python

Similar Reads

    OS Path module in Python
    OS Path module contains some useful functions on pathnames. The path parameters are either strings or bytes. These functions here are used for different purposes such as for merging, normalizing, and retrieving path names in Python. All of these functions accept either only bytes or only string obje
    2 min read
    Posixpath Module in Python
    The posixpath module is a built-in Python module that provides functions for manipulating file paths in a way that adheres to the POSIX standard. This module abstracts the differences in path handling between various operating systems, including Unix-like systems (e.g., Linux, macOS) and Windows. Im
    3 min read
    Pyscaffold module in Python
    Starting off with a Python project is usually quite complex and complicated as it involves setting up and configuring some files. This is where Pyscaffold comes in. It is a tool to set up a new python project, is very easy to use and sets up your project in less than 10 seconds! To use Pyscaffold, G
    4 min read
    Python Module Index
    Python has a vast ecosystem of modules and packages. These modules enable developers to perform a wide range of tasks without taking the headache of creating a custom module for them to perform a particular task. Whether we have to perform data analysis, set up a web server, or automate tasks, there
    4 min read
    Python | os.path.join() method
    The os.path.join() method is a function in the os module that joins one or more path components intelligently. It constructs a full path by concatenating various components while automatically inserting the appropriate path separator (/ for Unix-based systems and \ for Windows). ExamplePythonimport
    4 min read
    Python | os.path.islink() method
    OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality. os.path module is sub module of OS module in Python used for common path name man
    2 min read
    Python Modules
    Python Module is a file that contains built-in functions, classes,its and variables. There are many Python modules, each with its specific work.In this article, we will cover all about Python modules, such as How to create our own simple module, Import Python modules, From statements in Python, we c
    7 min read
    Import module in Python
    In Python, modules allow us to organize code into reusable files, making it easy to import and use functions, classes, and variables from other scripts. Importing a module in Python is similar to using #include in C/C++, providing access to pre-written code and built-in libraries. Python’s import st
    3 min read
    Python | os.path.ismount() method
    os.path module is sub module of Python OS Module in Python used for common path name manipulation. os.path.ismount() method in Python is used to check whether the given path is a mount point or not. A mount point is a point in a file system where a different file system has been mounted. os.path.ism
    2 min read
    Shutil Module in Python
    Shutil module offers high-level operation on a file like a copy, create, and remote operation on the file. It comes under Python’s standard utility modules. This module helps in automating the process of copying and removal of files and directories. In this article, we will learn this module. Copyin
    8 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

'); // $('.spinner-loading-overlay').show(); let script = document.createElement('script'); script.src = 'https://assets.geeksforgeeks.org/v2/editor-prod/static/js/bundle.min.js'; script.defer = true document.head.appendChild(script); script.onload = function() { suggestionModalEditor() //to add editor in suggestion modal if(loginData && loginData.premiumConsent){ personalNoteEditor() //to load editor in personal note } } script.onerror = function() { if($('.editorError').length){ $('.editorError').remove(); } var messageDiv = $('
').text('Editor not loaded due to some issues'); $('#suggestion-section-textarea').append(messageDiv); $('.suggest-bottom-btn').hide(); $('.suggestion-section').hide(); editorLoaded = false; } }); //suggestion modal editor function suggestionModalEditor(){ // editor params const params = { data: undefined, plugins: ["BOLD", "ITALIC", "UNDERLINE", "PREBLOCK"], } // loading editor try { suggestEditorInstance = new GFGEditorWrapper("suggestion-section-textarea", params, { appNode: true }) suggestEditorInstance._createEditor("") $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = true; } catch (error) { $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = false; } } //personal note editor function personalNoteEditor(){ // editor params const params = { data: undefined, plugins: ["UNDO", "REDO", "BOLD", "ITALIC", "NUMBERED_LIST", "BULLET_LIST", "TEXTALIGNMENTDROPDOWN"], placeholderText: "Description to be......", } // loading editor try { let notesEditorInstance = new GFGEditorWrapper("pn-editor", params, { appNode: true }) notesEditorInstance._createEditor(loginData&&loginData.user_personal_note?loginData.user_personal_note:"") $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = true; } catch (error) { $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = false; } } var lockedCasesHtml = `You can suggest the changes for now and it will be under 'My Suggestions' Tab on Write.

You will be notified via email once the article is available for improvement. Thank you for your valuable feedback!`; var badgesRequiredHtml = `It seems that you do not meet the eligibility criteria to create improvements for this article, as only users who have earned specific badges are permitted to do so.

However, you can still create improvements through the Pick for Improvement section.`; jQuery('.improve-header-sec-child').on('click', function(){ jQuery('.improve-modal--overlay').hide(); $('.improve-modal--suggestion').hide(); jQuery('#suggestion-modal-alert').hide(); }); $('.suggest-change_wrapper, .locked-status--impove-modal .improve-bottom-btn').on('click',function(){ // when suggest changes option is clicked $('.ContentEditable__root').text(""); $('.suggest-bottom-btn').html("Suggest changes"); $('.thank-you-message').css("display","none"); $('.improve-modal--improvement').hide(); $('.improve-modal--suggestion').show(); $('#suggestion-section-textarea').show(); jQuery('#suggestion-modal-alert').hide(); if(suggestEditorInstance !== null){ suggestEditorInstance.setEditorValue(""); } $('.suggestion-section').css('display', 'block'); jQuery('.suggest-bottom-btn').css("display","block"); }); $('.create-improvement_wrapper').on('click',function(){ // when create improvement option clicked then improvement reason will be shown if(loginData && loginData.isLoggedIn) { $('body').append('
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { showErrorMessage(e.responseJSON,e.status) }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ } $('.improve-modal--improvement').show(); }); const showErrorMessage = (result,statusCode) => { if(!result) return; $('.spinner-loading-overlay:eq(0)').remove(); if(statusCode == 403) { $('.improve-modal--improve-content.error-message').html(result.message); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); return; } } function suggestionCall() { var editorValue = suggestEditorInstance.getValue(); var suggest_val = $(".ContentEditable__root").find("[data-lexical-text='true']").map(function() { return $(this).text().trim(); }).get().join(' '); suggest_val = suggest_val.replace(/\s+/g, ' ').trim(); var array_String= suggest_val.split(" ") //array of words var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(editorValue.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `${editorValue}`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { if(!loginData || !loginData.isLoggedIn) { grecaptcha.reset(); } jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('.suggest-bottom-btn').css("display","none"); $('#suggestion-section-textarea').hide() $('.thank-you-message').css('display', 'flex'); $('.suggestion-section').css('display', 'none'); jQuery('#suggestion-modal-alert').hide(); }, error:function(data) { if(!loginData || !loginData.isLoggedIn) { grecaptcha.reset(); } jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 4 Words and Maximum Words limit is 1000."); jQuery('#suggestion-modal-alert').show(); jQuery('.ContentEditable__root').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('.ContentEditable__root').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('.ContentEditable__root').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('
'); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // script for grecaptcha loaded in loginmodal.html and call function to set the token setGoogleRecaptcha(); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('
'); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { showErrorMessage(e.responseJSON,e.status); }, }); });
"For an ad-free experience and exclusive features, subscribe to our Premium Plan!"
Continue without supporting
`; $('body').append(adBlockerModal); $('body').addClass('body-for-ad-blocker'); const modal = document.getElementById("adBlockerModal"); modal.style.display = "block"; } function handleAdBlockerClick(type){ if(type == 'disabled'){ window.location.reload(); } else if(type == 'info'){ document.getElementById("ad-blocker-div").style.display = "none"; document.getElementById("ad-blocker-info-div").style.display = "flex"; handleAdBlockerIconClick(0); } } var lastSelected= null; //Mapping of name and video URL with the index. const adBlockerVideoMap = [ ['Ad Block Plus','https://media.geeksforgeeks.org/auth-dashboard-uploads/abp-blocker-min.mp4'], ['Ad Block','https://media.geeksforgeeks.org/auth-dashboard-uploads/Ad-block-min.mp4'], ['uBlock Origin','https://media.geeksforgeeks.org/auth-dashboard-uploads/ub-blocke-min.mp4'], ['uBlock','https://media.geeksforgeeks.org/auth-dashboard-uploads/U-blocker-min.mp4'], ] function handleAdBlockerIconClick(currSelected){ const videocontainer = document.getElementById('ad-blocker-info-div-gif'); const videosource = document.getElementById('ad-blocker-info-div-gif-src'); if(lastSelected != null){ document.getElementById("ad-blocker-info-div-icons-"+lastSelected).style.backgroundColor = "white"; document.getElementById("ad-blocker-info-div-icons-"+lastSelected).style.borderColor = "#D6D6D6"; } document.getElementById("ad-blocker-info-div-icons-"+currSelected).style.backgroundColor = "#D9D9D9"; document.getElementById("ad-blocker-info-div-icons-"+currSelected).style.borderColor = "#848484"; document.getElementById('ad-blocker-info-div-name-span').innerHTML = adBlockerVideoMap[currSelected][0] videocontainer.pause(); videosource.setAttribute('src', adBlockerVideoMap[currSelected][1]); videocontainer.load(); videocontainer.play(); lastSelected = currSelected; }

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences