#!/usr/bin/python
#Filname is ospathinvalid.py
# Python program to check whether 
# the directory is empty or not 
import os 
# Function to Check if the path specified 
# specified is a valid directory 
def isEmpty(path): 
	if os.path.exists(path) and not os.path.isfile(path): 
		# Checking if the directory is empty or not 
		if not os.listdir(path): 
			print("Empty directory") 
		else: 
			print("Not empty directory") 
	else: 
		print("The path is either for a file or not valid") 


# path to a file 
path = "/root/python/one"

isEmpty(path) 
print() 

# valid path 
path = "/root/python"
isEmpty(path) 


29ad74b710e521a9a41291ad8643746955aa48c2
<mask token>


def isEmpty(path):
    if os.path.exists(path) and not os.path.isfile(path):
        if not os.listdir(path):
            print('Empty directory')
        else:
            print('Not empty directory')
    else:
        print('The path is either for a file or not valid')


<mask token>

<mask token>


def isEmpty(path):
    if os.path.exists(path) and not os.path.isfile(path):
        if not os.listdir(path):
            print('Empty directory')
        else:
            print('Not empty directory')
    else:
        print('The path is either for a file or not valid')


<mask token>
isEmpty(path)
print()
<mask token>
isEmpty(path)

<mask token>


def isEmpty(path):
    if os.path.exists(path) and not os.path.isfile(path):
        if not os.listdir(path):
            print('Empty directory')
        else:
            print('Not empty directory')
    else:
        print('The path is either for a file or not valid')


path = '/root/python/one'
isEmpty(path)
print()
path = '/root/python'
isEmpty(path)

import os


def isEmpty(path):
    if os.path.exists(path) and not os.path.isfile(path):
        if not os.listdir(path):
            print('Empty directory')
        else:
            print('Not empty directory')
    else:
        print('The path is either for a file or not valid')


path = '/root/python/one'
isEmpty(path)
print()
path = '/root/python'
isEmpty(path)

#!/usr/bin/python
#Filname is ospathinvalid.py
# Python program to check whether 
# the directory is empty or not 
import os 
# Function to Check if the path specified 
# specified is a valid directory 
def isEmpty(path): 
	if os.path.exists(path) and not os.path.isfile(path): 
		# Checking if the directory is empty or not 
		if not os.listdir(path): 
			print("Empty directory") 
		else: 
			print("Not empty directory") 
	else: 
		print("The path is either for a file or not valid") 


# path to a file 
path = "/root/python/one"

isEmpty(path) 
print() 

# valid path 
path = "/root/python"
isEmpty(path) 

