{"id":19249273,"url":"https://github.com/sous-chefs/fileutils","last_synced_at":"2025-04-21T12:31:33.293Z","repository":{"id":44551052,"uuid":"279401762","full_name":"sous-chefs/fileutils","owner":"sous-chefs","description":"Development repository for the fileutils cookbook","archived":false,"fork":false,"pushed_at":"2024-02-01T01:49:28.000Z","size":163,"stargazers_count":1,"open_issues_count":3,"forks_count":3,"subscribers_count":19,"default_branch":"main","last_synced_at":"2024-04-14T04:19:42.536Z","etag":null,"topics":["chef","chef-cookbook","chef-resource","fileutils","hacktoberfest","managed-by-terraform"],"latest_commit_sha":null,"homepage":"https://supermarket.chef.io/cookbooks/fileutils","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sous-chefs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"open_collective":"sous-chefs"}},"created_at":"2020-07-13T20:11:36.000Z","updated_at":"2023-11-28T05:59:50.000Z","dependencies_parsed_at":"2023-09-24T06:58:56.458Z","dependency_job_id":"6c63326f-66ad-4354-9c75-042b07a05860","html_url":"https://github.com/sous-chefs/fileutils","commit_stats":{"total_commits":150,"total_committers":19,"mean_commits":7.894736842105263,"dds":0.6733333333333333,"last_synced_commit":"ffc5bed17612a1fa849d336c75ccf318d763f760"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Ffileutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Ffileutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Ffileutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Ffileutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sous-chefs","download_url":"https://codeload.github.com/sous-chefs/fileutils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223187177,"owners_count":17102597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chef","chef-cookbook","chef-resource","fileutils","hacktoberfest","managed-by-terraform"],"created_at":"2024-11-09T18:13:30.481Z","updated_at":"2024-11-09T18:13:31.522Z","avatar_url":"https://github.com/sous-chefs.png","language":"Ruby","funding_links":["https://opencollective.com/sous-chefs"],"categories":[],"sub_categories":[],"readme":"# Description\n\nThis cookbook provides the fileutils resource.  The resource can be used to set attributes\non all of the files in a directory and subdirectory. We've had years of people\ncomplaining that the directory recursive mode, which is in fact a parent operation,\ndoes not work on subdirectories and files.  In this cookbook recursive refers\nto subdirectories and the files contained inside them.\n\n## Requirements\n\nDeveloped for RHEL and Solaris servers.\n\n## Resource Parameters\n\nThe fileutils resource will accept two actions.\n\n* :change is used to modify ownership and permission mode bit settings.\n* :delete is used to remove files and directories.\n  :delete always functions in a recursive mode.\n\n| Action | Parameter | Use\n| ------ | --------- | ---\n| :change | path     | Specify the starting path or file. The path must exist for anything to be done.\n|        | owner    | Set the owner of the files and directories to this value.\n|        | group    | Set the group of the files and directories to this value.\n|        | file_mode | Set the permission mode for files. Specify octal numbers or mode change symbols\n|        | directory_mode | Set the permission mode for directories. Specify octal numbers or mode change symbols\n|        | recursive | Boolean. Use top down traversal from the starting path. Default is true. When recursive is false only the initial directory and contents are changed.\n|        | only_files | Boolean. Only change files. Default is false.\n|        | only_directories | Boolean. Only change directories. Default is false.\n|        | pattern | Regex. Match to filter the basename of files and directories.\n|        | follow_symlink | Boolean. Continue on past symlinks. Very dangerous option with a high risk of changing unintended files. Default is false!\n|        | quiet | Boolean. Suppress output for changing each file. Default is false.\n\n| Action | Parameter | Use\n| ------ | --------- | ---\n| :delete | path     | Specify the starting path or file.\n|         | recursive | Delete always functions in recursive mode.\n|         | only_files | Boolean. Only delete files. Default is false.\n|         | pattern | Regex. Match to filter the basename of files and directories.\n|         | follow_symlink | Boolean. Continue on past symlinks. Very dangerous option with a high risk of deleting unintended files. Default is false!\n|         | force | Boolean. Use the for option with FileUtils.\n|         | quiet | Boolean. Supress output for deleting each file. Default is false.\n\n## Mode bit settings\n\nYou may specify the mode as a numeric value.\n\n0o600, 0600, '0600' and 420 will all create the same numeric setting.\nNote that '600' is treated as decimal 600 and is not the same as '0600'\nwhich is treated as octal 600.\n\nYou may use symbolic settings. Pick from the who list and add\nor subtract access permissions. The code tries to mimic the\nchmod command.\n\n### Who\n\n* u Owning user\n* g Owning group\n* o Others\n* a Everyone\n\n### Permissions\n\n* r Read\n* w Write\n* x Search/execute\n* s Assign user\n* t Sticky bit\n\n### Examples\n\n* '+r'  Adds read permissions to all files\n* 'g+r' Adds read permissions for the group to all files\n* 'o-w' Removes write permissions for other from all files\n\n## Usage\n\nA good example of why you would use the fileutils resource would be\nsetting attributes on files and directories after directory and file\nresources have created things. Notice that fileutils and directory\n resources treat recursive as moving in opposite directions.\n\n```ruby\n# Create some directories\ndir '/export/home/my/stuff/deep' do\n  recursive true  # creates parents\nend\n\n# Set the owner on multiple directories\nfileutils '/export/home/my' do # Set the child nodes\n  owner 'my'\nend\n\n# Empty a directory\nfileutils '/export/home/my' do\n  action :delete\nend\n\n# Set mode attributes\nfileutils '/export/home/my' do # Set the child nodes\n  file_mode ['o+r', 'g+w']\n  directory_mode ['o+rx', 'g+wrx']\nend\n\n# Change only the top level directory and it's files\n# should not change .../stuff/**\nfileutils '/export/home/my' do\n  recursive false\n  files_only true\n  file_mode ['0700']\nend\n```\n\n## Author\n\n* Mark Gibbons\n\n## Acknowlegments\n\n* Seth Vargo - [Vender gem technique](https://sethvargo.com/using-gems-with-chef/)\n* Samuel Gay - [Walk gem](https://github.com/samonzeweb/walk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsous-chefs%2Ffileutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsous-chefs%2Ffileutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsous-chefs%2Ffileutils/lists"}