#!/usr/bin/python3
import os
import sys
from pathlib import Path
def list_pdfs(directory="."):
	try:
		current_path=Path(directory)
		for item in current_path.iterdir():
			if item.is_file() and item.suffix.lower()=='.pdf':
				print(item.name)
	except Exception as e:
		print(f'Error - {str(e)}')
def main():
	if len(sys.argv) <3:
		print("Usage: python test2.py [folders|pdfs] [directory]")
		sys.exit(1)	
	command=sys.argv[1]
	target_dir=sys.argv[2]
	#print (f'{command} - {target_dir}')
	if command=="folders":
		pass
	elif command=="pdfs":
		list_pdfs()
	else:
		print("Invalid command")
		sys.exit(1)



if __name__=="__main__":
	main()
