You are not logged in.
Came across the "Magic Folder" plasmoid on a friend's KDE setup and liked the idea very much, especially for my downloads folder (I tend to download many things and then go through them later to sort away).
I found the "Download Sort" plugin for Firefox, but it doesn't always work and doesn't seem to be maintained anymore (last release 2006).
I also found this shell script on the Ubuntu forums, but it doesn't do what I want.
Does anyone know of a way (or a ready made program) that could do the following:
- Check every file that is placed in folder "X" (eg ~/downloads) [not only by Firefox, but always] and automatically distribute them to another folder by mime type or file extension
- This is not a must, but a nice and useful feature: automatically create subfolders by date for certain file types (useful for PDFs etc., but not needed for videos or music)
Thanks in advance
Last edited by JackH79 (2012-05-06 14:15:14)
Offline
I don't know about a ready program, but you can write a simple bash script to do that.
(I think this is very simalar to your ubuntu link, I can't view it).
#!/bin/bash
while read filename; do
echo -n "$filename "
case $(file -b --mime-type "$filename") in
image/png)
echo "is a png image"
mv -n "$filename" /somewhere/png/
;;
image/*)
echo "is an image"
mv -n "$filename" /somewhere/otherimages/
;;
application/pdf)
echo "is a pdf"
destdir="/somewhere/pdf/$(date +%Y.%m.%d)"
if [[ -d "$destdir" ]] || mkdir -p "$destdir"; then
mv -n "$filename" "$destdir/"
fi
;;
*)
echo "has mime $(file -b --mime-type "$filename"). I don't know what to do"
esac
done < <( find /path/to/magic/folder -type f )Offline
..and pair it with incron to make it magical without KDE ![]()
Offline
fsniper in aur does what you need
Offline
Thanks very much for all your suggestions.
Fsniper does exactly what I was looking for
So a special 'thank you' and a smiley face for parintachin: ![]()
Cheers
EDIT: Just for reference, I put up a wiki entry with some additional infos, including a way to run it as an rc.d daemon
Last edited by JackH79 (2012-05-28 08:57:48)
Offline