In the previous recipe, Working with locations, we created paths. In this recipe, we will create actual files and directories. The scenario is this:
- You have the random directory within $HOME. This directory contains dir-01, dir-02, dir-03, and dir-04. Create a file, called demo.txt within all of these four directories.
- Create new empty files, random-text.txt, himalayas.jpg, crunched-numbers.csv, screenshot-001.png, screenshot-002.png, screenshot-003.png, demo.doc, and my-plugin.rb, within $HOME/random/dir-01.
- Rename screenshot-001.png as myscreenshot.png.
- Copy myscreenshot.png into dir-02.
- Finally, remove the dir-04 directory, and everything within it.
Ensure that the script is platform-agnostic.