data-structure-typed 1.36.4 → 1.36.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +0,0 @@
1
- #!/bin/bash
2
-
3
- # iterate the directory to rename and clear content of files
4
- rename_and_clear_files() {
5
- local directory="$1"
6
- local extension="$2"
7
- local new_prefix="$3"
8
-
9
- for file in "$directory"/*; do
10
- if [ -d "$file" ]; then
11
- rename_and_clear_files "$file" "$extension" "$new_prefix"
12
- elif [ -f "$file" ] && [[ "$file" == *"$extension" ]]; then
13
- filename=$(basename "$file" "$extension")
14
- new_name="$directory/${filename}${new_prefix}${extension}"
15
- mv "$file" "$new_name"
16
- echo "Renamed $file to $new_name"
17
- > "$new_name" # clear content of file
18
- fi
19
- done
20
- }
21
-
22
- # check if directory, extension and prefix were provided
23
- if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
24
- echo "Usage: $0 <directory> <extension> <new_prefix>"
25
- exit 1
26
- fi
27
-
28
- # evoke the recursive function to rename and clear files
29
- rename_and_clear_files "$1" "$2" "$3"