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.

Source Distribution

fdir-1.0.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

fdir-1.0-py3.7-linux-x86_64.egg (22.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page