forked from thioshp/nemo_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileInfo
More file actions
executable file
·41 lines (35 loc) · 1.61 KB
/
FileInfo
File metadata and controls
executable file
·41 lines (35 loc) · 1.61 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
#!/bin/bash
FILENAME="$@"
#FILENAME=$(zenity --file-selection --title="Select file to be evaluated:")
#FILENAME=$@
fname="$(stat -c%n "$FILENAME")"
# Same as ""$FILENAME"" of course
fowner="$(stat -c%U "$FILENAME")"
fsize="$(stat -c%s "$FILENAME")"
# Certainly easier than using "ls -l "$FILENAME""
## and then parsing with sed
finode="$(stat -c%i "$FILENAME")"
ftype="$(file "$FILENAME")"
faccess_rights="$(stat -c%a "$FILENAME")"
faccess_rights2="$(stat -c%A "$FILENAME")"
fgid="$(stat -c%g "$FILENAME")"
fgrn="$(stat -c%G "$FILENAME")"
flast="$(stat -c%x "$FILENAME")"
fmod="$(stat -c%y "$FILENAME")"
WindowTitle="File/ Directory Info"
Message="File path:\t\t"$fname"\nFile owner (Name):\t\t"$fowner"\nFile owner (GID):\t\t"$fgid"\nFile owner (Group Name):\t\t"$fgrn"\nFile size:\t\t"$fsize" bytes\nFile inode:\t\t"$finode"\nFile type:\t\t"$ftype"\nOctal permissions:\t\t"$faccess_rights"\nPermissions:\t\t"$faccess_rights2"\nLast accessed:\t\t"$flast"\nLast modified:\t\t"$fmod""
$(zenity --info --title "$WindowTitle" --width 500 --text "$Message");
#echo "##################FILE OR DIRECTORY INFO###################"
#echo -e "File path:\t\t"$fname" "
#echo -e "File owner (Name):\t"$fowner" "
#echo -e "File owner (GID):\t"$fgid" "
#echo -e "File owner (Group Name):"$fgrn" "
#echo -e "File size:\t\t"$fsize" bytes"
#echo -e "File inode:\t\t"$finode" "
#echo -e "File type:\t\t"$ftype" "
#echo -e "Octal permissions:\t"$faccess_rights" "
#echo -e "Permissions:\t\t"$faccess_rights2" "
#echo -e "Last accessed:\t\t"$flast" "
#echo -e "Last modified:\t\t"$fmod" "
#echo "###########################################################"
exit 0