Write a script that takes the name of a directory as an argument and searches the file hierarchy rooted at that directory for zero-length files. Write the names of all zero-length files to standard output. If there is no option on the command line, have the script delete the file after displaying its name, asking the user for confirmation, and receiving positive confirmation. A –f (force) option on the command line indicates that the script should display the filename but not ask for confirmation before deleting the file.

What will be an ideal response?


The following script segment deletes only ordinary files, not directories. As
always, you must specify a shell and check the arguments.
$ cat zerdel
if [ "$1" == "-f" ]
then
find $2 -empty -print -exec rm -f {} \;
else
find $1 -empty -ok rm -f {} \;
fi

Computer Science & Information Technology

You might also like to view...

Every program has a(n) __________ __________ which is where the program begins and normally ends.

Fill in the blank(s) with correct word

Computer Science & Information Technology

A macro that is stored in the properties of forms, reports, or controls

a. autoexec macro b. button macro c. embedded macro

Computer Science & Information Technology

Each module should be tested separately in a procedure called validation testing

Indicate whether the statement is true or false.

Computer Science & Information Technology

A data flow diagram (DFD) shows _____.

A. how data arerelated B. what key fields are stored in the system C. how a system transforms input data into useful information D. what data is stored in the system

Computer Science & Information Technology