About 47,100 results
Open links in new tab
  1. How do I check whether a file exists without exceptions?

    How do I check whether a file exists or not, without using the try statement?

  2. How do I get the full path of the current file's directory?

    2814 The special variable __file__ contains the path to the current file. From that we can get the directory using either pathlib or the os.path module. Python 3 For the directory of the script …

  3. How to check if a directory exists in %PATH% - Stack Overflow

    In the folder you are going to search the PATH variable for, create a temporary file with such an unusual name that you would never ever expect any other file on your computer to have.

  4. Better way to check if a Path is a File or a Directory?

    Can someone edit the question title to specify "existing" file/directory? All of the answers apply to a path for a file/directory that is on disk.

  5. A better way to check if a path exists or not in PowerShell

    Aug 8, 2015 · Mathias R. Jessen Over a year ago @Eris question specifically asks to check if a file exists or not Eris Over a year ago

  6. linux - How to get full path of a file? - Stack Overflow

    On Windows: Holding Shift and right clicking on a file in Windows Explorer gives you an option called Copy as Path. This will copy the full path of the file to clipboard. On Linux: You can use …

  7. Check if a path represents a file or a folder - Stack Overflow

    Jun 21, 2019 · To check if a string represents a path or a file programatically, you should use API methods such as isFile(), isDirectory(). I guess, the file and folder entries are kept in a data …

  8. Find the current directory and file's directory [duplicate]

    393 Current working directory: os.getcwd() And the __file__ attribute can help you find out where the file you are executing is located. This Stack Overflow post explains everything: How do I …

  9. How can I check the extension of a file? - Stack Overflow

    You should make sure the "file" isn't actually a folder before checking the extension. Some of the answers above don't account for folder names with periods. (folder.mp3 is a valid folder name).

  10. how to check if a file is a directory or regular file in python?

    Jul 18, 2016 · Technically, all file system objects are files. A directory is a file but of a special type on most file systems. Then there are devices, pipes, sockets, etc. The os.stat() method in this …