Skip to main content

Module For Iterating through OS Directories

Project description

Module Setup


git clone https://github.com/m-zayan/fdir.git
Unzip file then open it
Open terminal (Linux) or cmd (Windows command prompt)
Type python setup.py build && python setup.py install

Modes


1 - ./ Dirctories (Folders)
2 - . Files
3 - .* Files with specific extension (eg : .csv or .pdf)
4 - // Files and Directories

Module Functions


listdir(str path,str mode)

The Function takes two arguments path and mode (1 , 2 , 3 or 4)
return List of pathes from given path

Ex


import fdir
pathes_list = fdir.listdir(path,'./') # return path of all folders at the current directory as same as (os.listdir)

itrAll(list paths,str mode)

The Function takes two arguments list of paths and mode (1 , 2 , 3 or 4)
return dictionary (str key,list paths)

Ex


import fdir
sub_files = fdir.itrAll(pathes_list,'./') # return paths of all folders for each path at list

itrDict(dict paths,str mode)

The Function takes two arguments dictionary of paths and mode (1 , 2 , 3 or 4)
return dictionary (str key,dict paths)

Ex


import fdir
dict_sub_files = fdir.itrAll(sub_files,'.pdf') # return paths of all pdf files for each list of paths at dictionary

walk(str paths,str mode)

The Function takes two arguments dictionary of paths and mode (1 , 2 , 3 or 4)
Recursively iterating through all files from initial path , Return List of all files which match mode

Ex


import fdir
pdf_files = fdir.walk(path,'.pdf') # return paths of all pdf files.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fdir, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size fdir-1.0-py3.7-linux-x86_64.egg (22.2 kB) File type Egg Python version 3.7 Upload date Hashes View
Filename, size fdir-1.0.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page