How to list file names which are only from a particular directory? I don't want file names from sub-directory or anything.
Use os.listdir() function The os. listdir('path') function returns a list containing the names of the files and directories present in the directory given by the path .
os. listdir(path='. ') It returns a list of all the files and sub directories in the given path.
os.listdir(dir)
Also see List files in ONLY the current directory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With