Skip to content

ronaldcotton/CS360-Systems-Programming-Recursive-Directories

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WSU Vancouver - CS360 - File Systems

Systems Programming - Assignment 3 - reading files recusively

C/File System Recusion Program

Abstract

This program does the following:

  • Takes one or zero command line arguments.
  • Argument, if present, is a pathname (relative or absolute). If no argument is present, the pathname of the present working directory is assumed (getcwd).
  • recursively traverses the directories and their files, starting with the pathname, and lists every regular file that is readable by the current process.
  • each regular file is listed to stdout as a full pathname, ne pathname per line.
  • No order is defined for the pathnames that are output.

Other:

  • Ignore symbolic links (Why?) - Symbolic link loop - Symoblic link to parent directory

C Functions Used:

  • chmod - change directory
  • access - check user's permissions for a file
  • opendir - open a directory
  • readdir - read a directory
  • closedir - close a directory
  • lstat - get file status

Requirements

GNU C and GNU make

Executing

    make
    ./readable <optional pathname>

to clean the project when done:

    make clean

Note

Better solutions exist, but constrained because of the restrictions of the assignment. Modern methods of file traversing can be found online, _BSD_SOURCE traversial is not recommended nor safe for production code.

About

A simple C program which recurses through directories

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published