[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Packages for file-finding & disk-usage
From: |
Sharon Kimble |
Subject: |
Re: Packages for file-finding & disk-usage |
Date: |
Tue, 20 Jan 2015 11:16:40 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
> I'm looking for two packages. I don't know if anything exists for these
> use cases:
>
> * HTML dependency finding.
>
> I often write webpages. I work by saving files in a tree of directories
> used by a web-server. Given "<a href=".../foo.html">Foo</a>" in a
> HTML file, I'd like to be able to easily tell if foo.html exists. For
> example to put point on it and see a message in the echo area like "file
> exists" or "file not found". Is there a package to do that?
>
> * Disk usage.
>
> I'm looking for a tool to monitor disk-usage. I want to know things
> like how much space the files in a particular directory take up. Also,
> what type of files use what amount of space. Is there a way of doing
> that within Emacs?
>
Robert.
I use this script, called "backsize", run from a cron job to monitor my backups
and
seeing their size -
--8<---------------cut here---------------start------------->8---
#!/bin/bash
# to get back-up directories size
file=~/cron/backshow
if ! >$file; then
echo "Error: Access issue while creating file";
exit 1;
fi
function ComposeFile() { #arg1 friendly_name; arg2 dir
size_kb=`(du -s $2 | awk '{print $1}') 2>/dev/null`;
if [ -n "${size_kb}" ]; then
#calculate into gb with 2 floting ponts controlled by scale
gb=`echo "scale=2; $size_kb / 1024 / 1024" | bc -l`;
#if you need wider columns change 25 into i.e. 35
printf '%-20s %-20s\n' "$1" "${gb}gb" >> $file
fi
}
# ComposeFile doesnt_exist /dummy
ComposeFile obnam-home /media/boudiccas/back1/obnam-home
ComposeFile music /media/boudiccas/back1/obnam-back4
sed -i '$!N;s/\n/ /' $file
cat $file
exit 0;
--8<---------------cut here---------------end--------------->8---
This then emails me the results when it runs -
--8<---------------cut here---------------start------------->8---
From: root@london (Cron Daemon)
Subject: Cron <boudiccas@london> /home/boudiccas/bin/backsize
To: boudiccas@localhost
Date: Tue, 20 Jan 2015 10:03:42 +0000 (1 hour, 10 minutes, 54 seconds ago)
obnam-home 406.64gb obnam-back4 250.72gb
--8<---------------cut here---------------end--------------->8---
Does it help?
Sharon.
--
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.6, emacs 24.4.1.0
signature.asc
Description: PGP signature