Coder Social home page Coder Social logo

hythm7 / p6-file-directory-tree Goto Github PK

View Code? Open in Web Editor NEW

This project forked from labster/p6-file-directory-tree

0.0 1.0 0.0 29 KB

Port of File::Path::Tiny to Perl 6 - create and delete directories

License: Artistic License 2.0

Raku 100.00%

p6-file-directory-tree's Introduction

p6-file-directory-tree

Build Status Build status

Raku module to create and delete directory trees.

SYNOPSIS

use File::Directory::Tree;

# make a new directory tree
mktree "foo/bar/baz/quux";
# delete what you just made
rmtree "foo";
# clean up your /tmp -- but don't delete /tmp itself
empty-directory "/tmp";

DESCRIPTION

This module provides recursive versions of mkdir and rmdir. This might be useful for things like setting up a repo all at once.

FUNCTIONS

mktree

Makes a directory tree with the given path. If any elements of the tree do not already exist, this will make new directories.

sub mktree ($path, $mask = 0o777)

Accepts an optional second argument, the permissions mask. This is supplied to mkdir, and used for all of the directories it makes; the default is 777 (a+rwx). It takes an integer, but you really should supply something in octal like 0o755 or :8('500').

Returns True if successful.

rmtree

This deletes all files under a directory tree with the given path before deleting the directory itself. It will recursively call unlink and rmdir until everything under the path is deleted.

Returns True if successful, and False if it cannot delete a file.

empty-directory

Also deletes all items in a given directory, but leaves the directory itself intact. After running this, the only thing in the path should be '.' and '..'.

Returns True if successful, and False if it cannot delete a file.

TODO

  • Probably handle errors in the test file better

SEE ALSO

AUTHOR

Brent "Labster" Laabs, 2013.

Contact the author at [email protected] or as labster on #perl6. File bug reports on github.

Based loosely on code by written Daniel Muey in Perl 5's File::Path::Tiny.

COPYRIGHT

This code is free software, licensed under the same terms as Perl 6; see the LICENSE file for details.

p6-file-directory-tree's People

Contributors

froggs avatar jj avatar labster avatar samcv avatar skids avatar stmuk avatar szabgab avatar zoffixznet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.