aboutsummaryrefslogtreecommitdiff
path: root/send-refresh.sh
diff options
context:
space:
mode:
authorSanJacobs2022-10-08 17:12:59 +0200
committerSanJacobs2022-10-08 17:12:59 +0200
commite9ff2775d8c54f77edcda5dc2cc80a8ad1194a02 (patch)
tree685b28f3b0701ba00eaa52354fd14dfa12de746b /send-refresh.sh
parent9ca037aa71266b3aaf3971e90e2c7b98ec7e927b (diff)
downloadsend-e9ff2775d8c54f77edcda5dc2cc80a8ad1194a02.tar.gz
send-e9ff2775d8c54f77edcda5dc2cc80a8ad1194a02.tar.bz2
send-e9ff2775d8c54f77edcda5dc2cc80a8ad1194a02.zip
Discovering files and listing them
Diffstat (limited to 'send-refresh.sh')
-rwxr-xr-x[-rw-r--r--]send-refresh.sh24
1 files changed, 23 insertions, 1 deletions
diff --git a/send-refresh.sh b/send-refresh.sh
index 371b596..aedcdee 100644..100755
--- a/send-refresh.sh
+++ b/send-refresh.sh
@@ -1,7 +1,29 @@
#!/bin/bash
# Recursively delete directories by age (14 days), and only exactly at the depth of the base directory
-find /path/to/base/dir/* -type d -mindepth 1 -maxdepth 1 -ctime +14 -exec rm -rf {} \;
+#find /path/to/base/dir/ -mindepth 1 -maxdepth 1 -type d -ctime +14 -exec rm -rf {} \;
+# Recursively discover files in the user's home directory, older than 14 days, and delete them
+#find /path/to/home/dir/ -mindepth 1 -maxdepth 1 -type f -ctime +14 -exec rm -rf {} \;
+# Recursively discover files in the user's home directory, younger than 14 days
+#find /path/to/home/dir/ -mindepth 1 -maxdepth 1 -type f -ctime -14
+
+# command for getting the filename out of a full path
+#basename /path/to/file.zip
+
+# Creating an array of homedirectory files younger than 14 days:
+
+young_files=()
+
+while IFS= read -r -d $'\0'; do
+ young_files+=("$REPLY")
+done < <(find /home/san/ -mindepth 1 -maxdepth 1 -type f -ctime -14 -name "*.zip" -print0)
+
+# Looping over said array:
+
+for file in "${young_files[@]}"; do
+ echo "$file"
+ echo "$(basename "$file")"
+done