Search for files by the specified path.
Project description
SearchFile
Table of contents
Installation
Installation using a terminal:
pip install SearchFile
Description
This library is designed to search for files by a given path.s the path we pass.
Using
import SearchFile
or
from SearchFile import search
The argument of the search
function is the path passed as a string. Also, the directory separator should be written in the form \\
, so as not to form control characters (\n, \t, \r, etc.). Examples:
search("C:\\Users")
search("D:\\Скачанные файлы\\test.txt")
search("D:\\Git\\cmd")
Code
import os
def search(path):
if os.path.isdir(path):
try:
for i in os.listdir(path):
if os.path.isdir(path + "\\" + i):
search(path + "\\" + i)
else:
print("\n", path + "\\" + i)
except PermissionError:
print("\n""Отказано в доступе - " + path)
else:
if os.path.isfile(path):
print(path)
else:
print("Неверно указан путь!")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SearchFile-0.0.1.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for SearchFile-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9eafd49ac51e9b584df9b7367d53f6c42157d095bc83d80da08f2ef1ea770ab2 |
|
MD5 | 61b992f6d9701142966f17a86f88a750 |
|
BLAKE2b-256 | 878b0282e9daab9ca6d6c2b365c75420e183095b339558a1f19bd9bf5dc35f7d |