Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Absolute Beginner Talk
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Absolute Beginner Talk
The perfect starting place to find out more about computers, Linux and Ubuntu.

 
Thread Tools Display Modes
Old July 24th, 2007   #1
deezay
5 Cups of Ubuntu
 
Join Date: Dec 2006
Beans: 31
Ubuntu 6.10 Edgy
looking for a 'magic folder' app... need some help

i'm lookin for an application that would reside on the desktop maybe in a taskbar or launch bar or something. but when you drag a certain file and release it on this app it will automatically send it to a folder of your choice.. aka a picture you downloaded that is saved onto the desktop from the web gets sent to a picture folder, music to a music folder, etc etc etc etc.. i know vista has something like this. it's called magic folder or something. i was curious if anyone knew of anything like this for linux. feel free to post with some links of your suggestions. thanks alot.
deezay is offline   Reply With Quote
Old July 24th, 2007   #2
Gen2ly
Dark Roasted Ubuntu
 
Gen2ly's Avatar
 
Join Date: Nov 2006
Location: There and back again
Beans: 1,039
Re: looking for a 'magic folder' app... need some help

I definitely like the idea! If you want to learn basic programming you should learn to write a script for this. It should be that difficult. Just would have to specify file endings ".end" and a simple line to mv them to the folder required.
Gen2ly is offline   Reply With Quote
Old July 24th, 2007   #3
deezay
5 Cups of Ubuntu
 
Join Date: Dec 2006
Beans: 31
Ubuntu 6.10 Edgy
Re: looking for a 'magic folder' app... need some help

i messed with vb during a quarter at itt... and i dont really recall much of it. is this something that could be done with python? if it's nothing too difficult i may tinker around with it. anyone else?
deezay is offline   Reply With Quote
Old July 24th, 2007   #4
Keen101
Quad Shot of Ubuntu
 
Keen101's Avatar
 
Join Date: Apr 2007
Location: Loveland, CO
Beans: 507
Ubuntu 8.10 Intrepid Ibex
Send a message via Yahoo to Keen101
Re: looking for a 'magic folder' app... need some help

the title "magic folder" caught my attention right away.

I haven't heard of anything like it before, but it sounds neat. It doesent sound that hard to make.


a script sounds like it might work, but I am not a programmer either.



good luck,

-keen101
Keen101 is offline   Reply With Quote
Old July 24th, 2007   #5
Al3xK3aton
Gee! These Aren't Roasted!
 
Join Date: Jul 2007
Beans: 155
Re: looking for a 'magic folder' app... need some help

Can't you just make a shortcut to the folder and drag it there? Why do you need a program to drag-and-drop files?
Al3xK3aton is offline   Reply With Quote
Old July 24th, 2007   #6
grishenko2000
5 Cups of Ubuntu
 
Join Date: Jul 2007
Location: Western Australia
Beans: 29
Ubuntu 6.06 Dapper
Re: looking for a 'magic folder' app... need some help

I thought the idea was pretty cool so I hacked up a shell script that can work on the desktop.

just cut and paste the following into a text file
Code:
#!/bin/bash

while [ $# -ge 1 ];
do
    case $1 in
        *.mp3)
            mv $1 ~/Desktop/Music
            ;;
        *.jpg | *.gif)
            mv $1 ~/Desktop/Pictures
            ;;
        *.doc | *.txt)
            mv $1 ~/Desktop/Documents
            ;;
        *)
            exit 0
            ;;
    esac
    shift
done
then in change it to be excutable with
Code:
chmod +x (name of file)
then you can create a launcher on the Desktop and drag and drop files into it.

At this stage i cant get it working on a taskbar or anything.

you need to change the directories for the filetypes to where you want then and can easily extend the script for other file types by extending the case statement.

alternatively you could make it a cron job that runs every couple of minutes to clean up the desktop.
grishenko2000 is offline   Reply With Quote
Old July 25th, 2007   #7
Gen2ly
Dark Roasted Ubuntu
 
Gen2ly's Avatar
 
Join Date: Nov 2006
Location: There and back again
Beans: 1,039
Re: looking for a 'magic folder' app... need some help

Nice very well reasoned out. I'm not sure you'd need more than that, thats perfectly resonable.
Gen2ly is offline   Reply With Quote
Old July 26th, 2007   #8
deezay
5 Cups of Ubuntu
 
Join Date: Dec 2006
Beans: 31
Ubuntu 6.10 Edgy
Re: looking for a 'magic folder' app... need some help

pretty nice, i appreciate the help guys/gals. i'll give this a whirl and see what all i can do with it. once again.. thanks!
deezay is offline   Reply With Quote
Old July 26th, 2007   #9
deezay
5 Cups of Ubuntu
 
Join Date: Dec 2006
Beans: 31
Ubuntu 6.10 Edgy
Re: looking for a 'magic folder' app... need some help

seems as if there is a space in the file name it doesn't put it into a folder... i thought that '*' pretty much covered that. how can you you get this script to recognize a space so it will continue to the files extention? many thanks!
deezay is offline   Reply With Quote
Old July 26th, 2007   #10
grishenko2000
5 Cups of Ubuntu
 
Join Date: Jul 2007
Location: Western Australia
Beans: 29
Ubuntu 6.06 Dapper
Re: looking for a 'magic folder' app... need some help

I dont know how i missed it ... its one of the main rules in shell scripting 101

to make it work with files with spaces just put " around every instance of $1.
i cant seem to find a simple way to make it case insensitive but you could modify it as follows.
Code:
case "$1" in
        *.[mM][pP]3)
            mv "$1" ~/Desktop/Music
            ;;
with square brackets and the upper and lower case letter.

if anyone has a simple way to make it case insensitive I would love to know about it.
grishenko2000 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:17 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry