This repository has been archived by the owner on Jun 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bashrc_functions
75 lines (63 loc) · 1.54 KB
/
bashrc_functions
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
# set bashrc to read:
# if [ -f ~/.bashrc_functions]; then
# source ~/.bashrc_functions
# fi
# functions
# brew reinstall nmaahcmm
function nmaahcmm () {
brew reinstall nmaahcmm
}
export -f nmaahcmm
# functions
# brew reinstall bashrc
function nmaahcbashrc () {
brew reinstall bashrc
}
export -f nmaahcbashrc
# make directories named after files
function makedirfile () {
for file in *.*; do
mkdir -p "${file%.*}";
done
}
export -f makedirfile
# rsync transfer for DAMS uploads
function rsyncDAMS () {
rsync -avvPhi --no-p --stats "${@}"
}
export -f rsyncDAMS
# general rsync transfer
function rsyncT () {
rsync -avvPhi --stats "${@}"
}
export -f rsyncT
# general rsync transfer with deletion of source files
function rsyncD () {
rsync -avvPhi --remove-source-files --stats "${@}"
}
export -f rsyncD
# remove hidden files from a location
function removehidden () {
if [ -z "${1}" ] ; then
cowsay "no argument provided. tootles."
else
find "${1}" -name ".*" -exec rm -vfr {} \;
cowsay "hidden files removed. tootles."
fi
}
export -f removehidden
# sort text in a file by column 2 and overwrite file ; column separator is a space.
function sortk2 () {
if [ -z "${1}" ]; then
cowsay "no argument provided. tootles."
else
sort -k 2 -o "${1}" "${1}"
cowsay "file sorting is done. tootles."
fi
}
export -f sortk2
function shortinfo() {
mediainfo --Inform="General;FileName=%FileNameExtension%\nFileSize=%FileSize%\nDuration=%Duration%" "${@}";
mediainfo --Inform="Video;Resolution=Codec=%CodecID%" "${@}";
}
export -f shortinfo