Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
recursive random file grabber (dirrand) 4
SUBMITTED BY:
Guest
DATE:
March 3, 2013, 6:06 a.m.
FORMAT:
Bash
SIZE:
546 Bytes
Raw
Download
Tweet
HITS:
1340
Go to comments
Report
#!/bin/bash
# pwd
let
R
=
$RANDOM
;
let
FILECOUNT
=
`
ls
|
wc
-l
`
;
#echo "random" $R;
# echo "filecount:" $FILECOUNT;
if
[
$FILECOUNT
-eq
0
]
;
then
pwd
fi
let
FILECOUNT
=
$R
%
$FILECOUNT
;
# echo $?
for
i
in
$(
ls
)
;
do
if
[
$FILECOUNT
-gt
0
]
;
then
let
FILECOUNT-
=
1
;
else
# file $i >/dev/null
# echo $i
cd
$i
2
>/dev/null
if
[
$?
-eq
0
]
;
then
$0
;
else
echo
`
pwd
`
"/"
$i
fi
exit
;
fi
done
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus