From 8b1d96ebf2b2907e131ab9fa477b08b06e69b065 Mon Sep 17 00:00:00 2001 From: Ziyi Dai Date: Wed, 8 Oct 2025 11:11:21 -0600 Subject: [PATCH 1/7] assignment --- assignment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment.sh b/assignment.sh index ef154f048..e1788da23 100644 --- a/assignment.sh +++ b/assignment.sh @@ -28,7 +28,7 @@ unzip -q rawdata.zip # Complete assignment here # 1. Create a directory named data -mkdir ./data +mkdir /data # 2. Move the ./rawdata directory to ./data/raw mv ./rawdata data/raw # 3. List the contents of the ./data/raw directory From 7e81c2487ef2c8c0bd34b84aa530137f71946e0f Mon Sep 17 00:00:00 2001 From: Ziyi Dai Date: Wed, 8 Oct 2025 11:43:11 -0600 Subject: [PATCH 2/7] assignment --- assignment.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assignment.sh b/assignment.sh index e1788da23..10c62492b 100644 --- a/assignment.sh +++ b/assignment.sh @@ -28,11 +28,11 @@ unzip -q rawdata.zip # Complete assignment here # 1. Create a directory named data -mkdir /data +mkdir -p ./data # 2. Move the ./rawdata directory to ./data/raw -mv ./rawdata data/raw +mv ./rawdata ./data/raw # 3. List the contents of the ./data/raw directory -ls data/raw +ls ./data/raw # 4. In ./data/processed, create the following directories: server_logs, user_logs, and event_logs cd data mkdir processed @@ -51,7 +51,7 @@ rm raw/*ipaddr* rm processed/user_logs/*ipaddr* # 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed touch inventory.txt -find processed > inventory.txt +find processed -mindepth 2 -type f > inventory.txt ########################################### echo "Project setup is complete!" From 4040723ed5d0466f0e2486ed05cf4d3956cd0b39 Mon Sep 17 00:00:00 2001 From: Ziyi Dai Date: Wed, 8 Oct 2025 12:19:05 -0600 Subject: [PATCH 3/7] assignment --- assignment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment.sh b/assignment.sh index 10c62492b..6125a77da 100644 --- a/assignment.sh +++ b/assignment.sh @@ -28,7 +28,7 @@ unzip -q rawdata.zip # Complete assignment here # 1. Create a directory named data -mkdir -p ./data +mkdir data # 2. Move the ./rawdata directory to ./data/raw mv ./rawdata ./data/raw # 3. List the contents of the ./data/raw directory From adba31e99de30127914b8f59e8a18fc26cc2f86d Mon Sep 17 00:00:00 2001 From: Ziyi Dai Date: Wed, 8 Oct 2025 12:36:55 -0600 Subject: [PATCH 4/7] test --- assignment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment.sh b/assignment.sh index 6125a77da..3bee0c8b3 100644 --- a/assignment.sh +++ b/assignment.sh @@ -26,7 +26,7 @@ unzip -q rawdata.zip ########################################### # Complete assignment here - +pwd # 1. Create a directory named data mkdir data # 2. Move the ./rawdata directory to ./data/raw From 30ec4c48ee1ed7ae210ef79570a271f5ec038da9 Mon Sep 17 00:00:00 2001 From: Ziyi Dai Date: Wed, 8 Oct 2025 12:49:41 -0600 Subject: [PATCH 5/7] test --- assignment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment.sh b/assignment.sh index 3bee0c8b3..6125a77da 100644 --- a/assignment.sh +++ b/assignment.sh @@ -26,7 +26,7 @@ unzip -q rawdata.zip ########################################### # Complete assignment here -pwd + # 1. Create a directory named data mkdir data # 2. Move the ./rawdata directory to ./data/raw From b4edaebd27c2ce84808db47e6c475161d2bcfda2 Mon Sep 17 00:00:00 2001 From: zdai399 Date: Wed, 8 Oct 2025 14:57:14 -0400 Subject: [PATCH 6/7] Delete assignment.sh --- assignment.sh | 57 --------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 assignment.sh diff --git a/assignment.sh b/assignment.sh deleted file mode 100644 index 6125a77da..000000000 --- a/assignment.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -x - -############################################ -# DSI CONSULTING INC. Project setup script # -############################################ -# This script creates standard analysis and output directories -# for a new project. It also creates a README file with the -# project name and a brief description of the project. -# Then it unzips the raw data provided by the client. - -if [ -d newproject ]; then - echo "Directory 'newproject' already exists. Please remove it before running this script." - exit 1 -fi -mkdir newproject -cd newproject - -mkdir analysis output -touch README.md -touch analysis/main.py - -# download client data -curl -Lo rawdata.zip https://github.com/UofT-DSI/shell/raw/refs/heads/main/02_activities/assignments/rawdata.zip -unzip -q rawdata.zip - -########################################### -# Complete assignment here - -# 1. Create a directory named data -mkdir data -# 2. Move the ./rawdata directory to ./data/raw -mv ./rawdata ./data/raw -# 3. List the contents of the ./data/raw directory -ls ./data/raw -# 4. In ./data/processed, create the following directories: server_logs, user_logs, and event_logs -cd data -mkdir processed -cd processed -mkdir server_logs -mkdir user_logs -mkdir event_logs -# 5. Copy all server log files (files with "server" in the name AND a .log extension) from ./data/raw to ./data/processed/server_logs -cd .. -cp raw/*server*.log processed/server_logs -# 6. Repeat the above step for user logs and event logs -cp raw/*user*.log processed/user_logs -cp raw/*event*.log processed/event_logs -# 7. For user privacy, remove all files containing IP addresses (files with "ipaddr" in the filename) from ./data/raw and ./data/processed/user_logs -rm raw/*ipaddr* -rm processed/user_logs/*ipaddr* -# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed -touch inventory.txt -find processed -mindepth 2 -type f > inventory.txt -########################################### - -echo "Project setup is complete!" From 370ccace1e687975c49df4fa38600d25e69ce7c5 Mon Sep 17 00:00:00 2001 From: Ziyi Dai Date: Wed, 8 Oct 2025 13:02:33 -0600 Subject: [PATCH 7/7] test --- assignment.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 assignment.sh diff --git a/assignment.sh b/assignment.sh new file mode 100644 index 000000000..6125a77da --- /dev/null +++ b/assignment.sh @@ -0,0 +1,57 @@ +#!/bin/bash +set -x + +############################################ +# DSI CONSULTING INC. Project setup script # +############################################ +# This script creates standard analysis and output directories +# for a new project. It also creates a README file with the +# project name and a brief description of the project. +# Then it unzips the raw data provided by the client. + +if [ -d newproject ]; then + echo "Directory 'newproject' already exists. Please remove it before running this script." + exit 1 +fi +mkdir newproject +cd newproject + +mkdir analysis output +touch README.md +touch analysis/main.py + +# download client data +curl -Lo rawdata.zip https://github.com/UofT-DSI/shell/raw/refs/heads/main/02_activities/assignments/rawdata.zip +unzip -q rawdata.zip + +########################################### +# Complete assignment here + +# 1. Create a directory named data +mkdir data +# 2. Move the ./rawdata directory to ./data/raw +mv ./rawdata ./data/raw +# 3. List the contents of the ./data/raw directory +ls ./data/raw +# 4. In ./data/processed, create the following directories: server_logs, user_logs, and event_logs +cd data +mkdir processed +cd processed +mkdir server_logs +mkdir user_logs +mkdir event_logs +# 5. Copy all server log files (files with "server" in the name AND a .log extension) from ./data/raw to ./data/processed/server_logs +cd .. +cp raw/*server*.log processed/server_logs +# 6. Repeat the above step for user logs and event logs +cp raw/*user*.log processed/user_logs +cp raw/*event*.log processed/event_logs +# 7. For user privacy, remove all files containing IP addresses (files with "ipaddr" in the filename) from ./data/raw and ./data/processed/user_logs +rm raw/*ipaddr* +rm processed/user_logs/*ipaddr* +# 8. Create a file named ./data/inventory.txt that lists all the files in the subfolders of ./data/processed +touch inventory.txt +find processed -mindepth 2 -type f > inventory.txt +########################################### + +echo "Project setup is complete!"