99# project name and a brief description of the project.
1010# Then it unzips the raw data provided by the client.
1111
12+ # added to remove project folder to enable the script to directly delete any pre-existing folder
13+ rm -rf newproject
14+
1215if [ -d newproject ]; then
1316 echo " Directory 'newproject' already exists. Please remove it before running this script."
1417 exit 1
@@ -26,24 +29,38 @@ unzip -q rawdata.zip
2629
2730# ##########################################
2831# Complete assignment here
32+ # added this to remove file folder
33+ rm -rf data
2934
3035# 1. Create a directory named data
36+ mkdir data
3137
3238# 2. Move the ./rawdata directory to ./data/raw
39+ mv ./rawdata ./data/raw
3340
3441# 3. List the contents of the ./data/raw directory
42+ ls ./data/raw
3543
3644# 4. In ./data/processed, create the following directories: server_logs, user_logs, and event_logs
45+ # -p will create the leading folders because processed is initially not there, so you add the processed folder and server/user/event logs
46+ mkdir -p ./data/processed/server_logs
47+ mkdir -p ./data/processed/user_logs
48+ mkdir -p ./data/processed/event_logs
3749
3850# 5. Copy all server log files (files with "server" in the name AND a .log extension) from ./data/raw to ./data/processed/server_logs
51+ cp ./data/raw/* server* .log ./data/processed/server_logs
3952
4053# 6. Repeat the above step for user logs and event logs
54+ cp ./data/raw/* user* .log ./data/processed/user_logs
55+ cp ./data/raw/* event* .log ./data/processed/event_logs
4156
4257# 7. For user privacy, remove all files containing IP addresses (files with "ipaddr" in the filename) from ./data/raw and ./data/processed/user_logs
58+ rm -f ./data/raw/* ipaddr* ./data/processed/user_logs/* ipaddr*
4359
4460# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed
45-
61+ # > means to take the results and stored somewhere else
62+ find ./data/processed -type f > ./data/inventory.txt
4663
4764# ##########################################
4865
49- echo " Project setup is complete!"
66+ echo " Project setup is complete!"
0 commit comments