Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Bash script named indexer. This script should take a path to a directory as a command line argument. If one is not provided
Write a Bash script named indexer. This script should take a path to a directory as a command line argument. If one is
not provided or the argument is not a valid directory, you should print an error message and exit. Otherwise, your program
should print nothing.
In each directory in the inputted directory recursively, including the inputted directory itself, you should create a file named
index.json. If one is already present, you should overwrite it No other files should be created, deleted, or modified.
index.json should be a JSON file that contains lists of the regular files and directories in that directory, and a relative
path back to the inputted directory. Your code should work correctly even if any filenames have spaces.
Directories may contain a file named special andor a file named blacklist. Both of these files, if present, will have a
single filename on each line. If a file is in a directorys blacklist, it shouldnt be included in that directorys index.json.
If a file is in a directorys special, the file should go into a different section of that directorys index.json. Neither the
blacklist nor special files themselves should be included in any index.json file lists
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started