8.5. Simple I/O

8.5.1. Reverser

Write an application which reads a line from stdin and prints the same string back, but reversed.

Modify it so it keeps repeating this process forever.

8.5.2. Bulk rename

You will need the filepath and directory library.

Implement a function which:

  • takes as argument a string
  • then scans the current directory and finds all files
  • renames each file by prepending the string argument to the filename

8.5.2.1. Advanced

Get the input string from the application arguments [1].

8.5.3. Combine files

You will need the filepath and directory library.

Implement a function which:

  • Scans the current directory
  • finds all files
  • reads each file and collects the contents in a list
  • writes a combined output file with the contents of each of the files concatenated.

8.5.3.1. Advanced

Instead of collecting to a list open the output file first and write each files contents to the output handle right away.

footnotes

[1]Use the getArgs function.