-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfiles_clean
executable file
·30 lines (26 loc) · 943 Bytes
/
files_clean
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
#!/bin/sh
# vim: set tw=1000:
D=${HOME}/Downloads
DIMG=${D}/img
DDMG=${D}/dmg
DVID=${D}/vid
DAUD=${D}/audio
DDOC=${D}/doc
DWEB=${D}/web
mkdir -p $D
mkdir -p $DIMG
mkdir -p $DDMG
mkdir -p $DVID
mkdir -p $DAUD
mkdir -p $DDOC
mkdir -p $DWEB
PRE=echo
if [ "$1" != "--run" ]; then
PRE=
fi
find -E ${D} -depth 1 -iregex ".*\.(jpg|png|jpeg|pneg|tiff)$" -print0| xargs -0 -n1 -I@ echo mv -n @ $DIMG
find -E ${D} -depth 1 -iregex ".*\.(dmg|pkg)$" -print0| xargs -0 -n1 -I@ echo mv -n @ $DDMG
find -E ${D} -depth 1 -iregex ".*\.(avi|mpg|mpeg|mp4|flv|mkv)$" -print0| xargs -0 -n1 -I@ echo mv -n @ $DVID
find -E ${D} -depth 1 -iregex ".*\.(mp3|mpg|off)$" -print0| xargs -0 -n1 -I@ echo mv -n @ $DAUD
find -E ${D} -depth 1 -iregex '.*\.(pdf|rtf|doc|docx)$' -print0| xargs -0 -n1 -I@ echo mv -n @ $DDOC
find -E ${D} -depth 1 -iregex ".*\.(html)$" -print0| xargs -0 -n1 -I@ echo mv -n @ $DWEB