-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-file.sh
More file actions
31 lines (31 loc) · 898 Bytes
/
validate-file.sh
File metadata and controls
31 lines (31 loc) · 898 Bytes
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
#!/bin/bash
echo "Validation de fichier"
read -p "Entrez le chemin du fichier à valider : " file_path
if [-e "$file_path"]; then
echo "Le fichier existe."
if [-f "$file_path"]; then
echo "C'est un fichier régulier."
elif [-d "$file_path"]; then
echo "C'est un répertoire."
else
echo "Ce n'est ni un fichier , ni un repertoire."
fi
if [-r "$file_path"]; then
echo "Le fichier est lisible."
else
echo "Le fichier n'est pas lisible."
fi
if [-w "$file_path"]; then
echo "Le fichier est modifiable."
else
echo "Le fichier n'est pas modifiable."
fi
if [-x "$file_path"]; then
echo "Le fichier est exécutable."
else
echo "Le fichier n'est pas exécutable."
fi
echo "Taille du fichier : $(stat -c%s "$file_path") bytes"
else
echo "Le fichier n'existe pas."
fi