Don’t use os.walk.
Example:
import os
root = "C:\\"
for item in os.listdir(root):
if os.path.isfile(os.path.join(root, item)):
print item
More Related Contents:
- How do I create a python code that distinguishes between the capital of a state and the state that the capital has?
- How to name a file using a value in a list in a dictionary?
- How to copy files?
- How do I watch a file for changes?
- Search and replace a line in a file in Python
- How do I get file creation and modification date/times?
- How to search and replace text in a file?
- Loading and parsing a JSON file with multiple JSON objects
- How to upload file with python requests?
- Using os.walk() to recursively traverse directories in Python
- Basic http file downloading and saving to disk in python?
- What is the best way to open a file for exclusive access in Python?
- Compare two different files line by line in python
- Read from file after write, before closing
- TypeError: expected a character buffer object – while trying to save integer to textfile
- python – Read file from and to specific lines of text
- How do I change the file creation date of a Windows file?
- In Python, is there a concise way of comparing whether the contents of two text files are the same?
- Re-read an open file Python
- Is there a need to close files that have no reference to them?
- python copy files by wildcards
- Filtering os.walk() dirs and files
- Fastest way to write huge data in file
- Reading integers from binary file in Python
- create file of particular size in python
- Do files get closed during an exception exit?
- pickle – putting more than 1 object in a file? [duplicate]
- HTML to IMAGE using Python
- UTF-8 HTML and CSS files with BOM (and how to remove the BOM with Python)
- Change the file extension for files in a folder?