Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a system with Ubuntu installed in 20GB and windows in 100 GB, two partitions - each of 100GB using NTFS. While using DC++ (multiple downloading of big file) I used to get message that system is running out of memory.

Is there any way to make a deamon which will be checking the Ubuntu partition so that if its used space goes up to a certain amount (let's say 18 GB) it will automatically start a moving file from this drive to another drive (let's assume it will pick the file from movie folder or largest media file from this drive to move)?

Or it prompt to ask from user which file to move?

Is there any program which can do this for me? If not, can you suggest something to read so that I could make it?

share|improve this question
Why don't you make dc++ download directly to one of your 100gb NTFS partitions? – Hashken Dec 10 '12 at 20:05
up vote 4 down vote accepted

Why don't you just point DC++ to save to another drive by default instead of constantly moving files around?

A solution similar to what you have asked for:



    largestFile="`ls -S -w1 "$1"/*.avi | head -n 1`"
    mv "$largestFile" "$dstDir"

your-app &

while [ "`ps -A | grep $appPid`" ]; do
    usePercent=$(df -h | grep "$srcPart" | grep -o "[0-9]\{1,3\}%" | sed 's/%//')
    if [ $usePercent -gt 95 ]; then
        moveLargestFile "$HOME/Movies"
    sleep 60

This sript will launch your app (don't forget to specify it) in the background and will monitor the selected partition srcPart until you quit the application. If during its executing, filesystem usage goes over 95%, we'll select the largest avi file in $HOME/Movies folder and move it to the specified location.

share|improve this answer
Welcome to Ask Ubuntu! This is a great answer, keep it up. We can't wait to see you here more frequently in our community :) – Mochan Dec 10 '12 at 21:29
Thanks :) It is indeed my first post here. – Pavel A Dec 10 '12 at 21:55
thanks man .. small and perfect solution.. :) – RATHI Dec 11 '12 at 4:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.