-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDirectory Management
More file actions
137 lines (133 loc) · 2.48 KB
/
Copy pathDirectory Management
File metadata and controls
137 lines (133 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
echo " "
echo "----Directory Management----"
echo " "
ch=0
while [ $ch -lt 6 ]
do
echo "Press the following to :"
echo "1) Create a new directory."
echo "2) Modify a directory."
echo "3) Navigate into directory."
echo "4) Listing directories."
echo "5) Exit."
read ch
case $ch in
1) echo " "
echo "---Creation of Directory---"
echo " "
echo "Enter the name of the directory:"
read name
mkdir $name
;;
2) echo " "
echo "---Modification of Directory---"
echo " "
echo "Enter the directory to be modified:"
read orgdir
echo "Press the following to :"
echo " "
echo "1) Rename directory."
echo "2) Copy directory to another."
echo "3) Move directory."
echo "4) Delete directory."
echo "5) Exit from Modify Mode."
read modch
case $modch in
1) echo " "
echo "---Rename a directory---"
echo " "
echo "Enter new name for the directory:"
read newname
mv $orgdir $newname
;;
2) echo " "
echo "---Copying a directory to another---"
echo " "
echo "Enter target directory:"
read target
mkdir $target
cp $orgdir $target
;;
3) echo " "
echo "---Moving a directory---"
echo " "
echo "Enter target directory:"
read target
mkdir $target
mv $orgdir $target
;;
4) echo " "
echo "---Deleting a directory---"
echo " "
rmdir $orgdir
;;
5) echo " "
echo "---Exiting from modify mode---"
echo " "
exit
;;
esac
;;
3)
echo "---Navigation of Directory---"
echo " "
echo "Enter your choice for method of navigation :"
echo "1) Go to Parent Directory. "
echo "2) Navigate to specific directory."
echo "3) Exit from Navigate Mode."
read navch
case $navch in
1) echo " "
echo "---Parent Directory---"
echo " "
cd ..
pwd
;;
2) echo " "
echo "---Navigation to Specific Directory---"
echo " "
echo "Enter the target Path:"
read path
cd $path
pwd
;;
3) echo " "
echo "---Exiting from Navigate Mode---"
echo " "
exit
;;
esac
;;
4)
echo "--- Listing of Directories---"
echo " "
echo "Enter your choice for method of listing :"
echo "1) List of directories. "
echo "2) List of directories and their details."
echo "3) Exit from List Mode."
read lisch
case $lisch in
1) echo " "
echo "---List of directories---"
echo " "
ls
;;
2) echo " "
echo "---Detailed List of directories---"
echo " "
ls -l
;;
3) echo " "
echo "---Exiting from List Mode---"
echo " "
exit
;;
esac
;;
5)echo " "
echo "---Exiting---"
echo " "
exit
;;
esac
done