Skip to main content

Installation

$ pip3 install efdir

License

  • MIT

Quickstart

  • pip3 install efdir

  • edit a cfg.rst file using bullet-list as below:

/docs/images/rst.0.png
  • run cmd efdir cfg.rst wkdir

/docs/images/mktree.0.png

Usage

  • fobj

    from efdir import fobj
    
    # creat a dir
    fo = fobj.F('tstdir')
    fo
    #>>> fo
    #/opt/PY3/EFDIR/TEST/tstdir
    
    # creat subdir
    fo.subdir0
    fo.subdir1
    fo.sub#<TAB>
    
    #>>> fo.subdir0
    #/opt/PY3/EFDIR/TEST/tstdir/subdir0
    #>>> fo.subdir1
    #/opt/PY3/EFDIR/TEST/tstdir/subdir1
    #>>>
    #>>> fo.subdir
    #fo.subdir0  fo.subdir1
    #>>> fo.subdir
    
    fo.subdir0.dir10
    fo.subdir0.dir11
    fo.subdir0.dir12
    #>>> fo.subdir0.dir10
    #/opt/PY3/EFDIR/TEST/tstdir/subdir0/dir10
    #>>> fo.subdir0.dir11
    #/opt/PY3/EFDIR/TEST/tstdir/subdir0/dir11
    #>>> fo.subdir0.dir12
    #/opt/PY3/EFDIR/TEST/tstdir/subdir0/dir12
    #>>>
    
    #check
    import os
    os.system('tree tstdir')
    #>>> import os
    #>>> os.system('tree tstdir')
    #tstdir
    #├── subdir0
    #│   ├── dir10
    #│   ├── dir11
    #│   └── dir12
    #└── subdir1>>> import os
    #
    
    #rename
    
    fo.subdir0 = "subdir00"
    fo.subdir#<TAB>
    
    #>>> fo.subdir0 = "subdir00"
    #>>> fo.subdir
    #fo.subdir00  fo.subdir1
    #>>> fo.subdir
    
    #rmdir
    del fo.subdir1
    os.system('tree tstdir')
    
    #>>> del fo.subdir1
    #/opt/PY3/EFDIR/TEST/tstdir/subdir1
    #>>>
    #>>> os.system('tree tstdir')
    #tstdir
    #└── subdir00
    #    ├── dir10
    #    ├── dir11
    #    └── dir12
    
    
    
    # parent
    fo.subdir00.dir12.__parent
    fo.subdir00.dir12.__parent.__parent
    fo.subdir00.dir12.__parent.__parent.__parent
    # >>> fo.subdir00.dir12.__parent
    # /tstdir/subdir00
    # >>> fo.subdir00.dir12.__parent.__parent
    # /tstdir
    # >>> fo.subdir00.dir12.__parent.__parent.__parent
    # null
    # >>>
  • using .rst

     import efdir.mktree as emk
    
    
    # if the name end with a "$", it means this is a file, such as "xx$",  will touch a empty file named xx
    # else, it means this is a dir ,will make a dir
    
    rst_cfg = """
    - a
    
        - b
    
                - xx$
                - yy
                - zz
        - c
        - d
    - e
    - f
    """
    
    
    emk.mktree(rst_cfg,"./wkdir")
    #or directly from a cfg.rst file(filename must end with .rst)
    emk.fmktree("./cfg.rst","./wkdir")
    
    ######################
    TEST# tree wkdir
    wkdir
    ├── a
    │   ├── b
    │   │   ├── xx
    │   │   ├── yy
    │   │   └── zz
    │   ├── c
    │   └── d
    ├── e
    └── f
    
    8 directories, 1 file
    ######################
  • using .json

    import efdir.mktree as emk
    # if the name end with a "$", it means this is a file, such as "init.sh$",  will touch a empty file named init.sh
    # else, it means this is a dir ,will make a dir
    
    json_cfg = {
        "REPO":{
            "BACKUP" : {},
            "DRAFT" : {},
            "INIT" : {
                "init.sh$":{}
            },
            "EDICT" : {
                "IMGS":{
                    "img0.desc$":{},
                    "img1.desc$":{}
                },
                "DETAILS":{
                    "1.info$":{},
                    "2.info$":{}
                },
                "edict.py$":{}
            },
            "setup.py$":{},
            "README.md$":{},
            "LICENSE$":{},
            "install.sh$":{},
            "uninstall.sh$":{},
            "update.sh$":{},
            "pypiupload.sh$":{}
        }
    }
    
    emk.mktree(json_cfg,"./wkdir")
    #or directly from a cfg.json file(filename must end with .rst)
    emk.fmktree("./cfg.json","./wkdir")
  • from cmdline

    root@# efdir cfg.rst "rstwkdir"
    root@# tree rstwkdir
    root@# efdir cfg.json "jsonwkdir"
    root@# tree jsonwkdir

Features

  • mktree from .rst bullet-list config

  • mktree from .json config

References

  • docutils

  • shutil

Metadata

Release files for efdir 0.0.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for efdir 0.0.24
File Size Uploaded Provenance
efdir-0.0.24.tar.gz 20.1 kB Without provenance Details

Release files / efdir-0.0.24.tar.gz

Download URL efdir-0.0.24.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6bb806b2888bf77d90eaab50230547f3b4dd0990acaf75c19bec51766f0f8d1d
BLAKE2b-256 checksum
How to use checksums
b857ac521fa48f0d2bebc1d090f3ad7644d0bfc111ada8be4d5c7a55cca0433b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.9

Security for efdir 0.0.24

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page