Author Topic: File Organiser  (Read 2214 times)

0 Members and 1 Guest are viewing this topic.

Offline ElectricNoodle

  • Serf
  • *
  • Posts: 38
  • Cookies: 6
    • View Profile
File Organiser
« on: August 23, 2011, 10:11:07 pm »
Hey :P

I've created myself a small program that, lets you set up say, three folders called.... Music Photo's and Documents or whatever.. and then for each folder, you tell it what extensions to class as Music or Photo's etc.. You then point it to the unorganised messy folder that you want it to sort.. and it very quickly moves all the relevant files to the folders specified :)

Now I was just wondering if anyone on here would find that useful? In its current state its usable by me, but im sure errors could be caused!! So Should I error protect it, smarten it up a bit and release it, or just keep it to myself? :P

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: File Organiser
« Reply #1 on: August 23, 2011, 10:29:34 pm »
Well... I certainly would not want to loose all the porn during while your app does something. Of course you should do the error protection. No. You MUST do the error protection. Personally I wouldn't use it :P no windows user here (yep!) but I do have Windows and even then I would not use it because my porn is already sorted :P
Though it might be a good app for someone who is messing around with an old hard drive or something like that and wants to sort shit out real quick.

Instead of making three folders, make it detect extensions and create as many folders for each extension and put files there accordingly - more usability and flexibility.

Also instead of pointing to a folder, make it look in a list of folders or the whole drive.

Just think about what people would really need, because your idea right now is very static and not really usable.

Offline petermlm

  • Knight
  • **
  • Posts: 226
  • Cookies: 7
  • Information is Power
    • View Profile
    • Security Check
Re: File Organiser
« Reply #2 on: August 24, 2011, 02:42:01 am »
That is nice. The main chalenge would be to write a directory crawler, lol. Anyway, not that I need it, but really good idea! This could also give statistical information, like disk usage, amount of files of x type and y type, similar files found (like duplicated files or something), maybe search inside zip files or rar files, brainstorming, brainstorming some more, xD.

OP, how are you planing to develop this, I mean, what languages, libraries, for what system, etc?

Offline xzid

  • Knight
  • **
  • Posts: 329
  • Cookies: 41
    • View Profile
Re: File Organiser
« Reply #3 on: August 24, 2011, 08:23:01 am »
With powershell you can do this very easily

Code: [Select]
# config
$src = "C:\old"
$dest = "C:\new"

# create the dirs
foreach($d in @($dest, "$dest\pics\", "$dest\vids\")) { mkdir $d }

# loop through all the files
ls -Recurse $src | % {
  switch($_.extension) {
    "jpg" { cp $_.fullname "$dest\pics\" }
    "png" { cp $_.fullname "$dest\pics\" }
    "avi" { cp $_.fullname "$dest\vids\" }
    # etc..
    # if has no extension, probably directory(not a vid/pic/music file for sure)
  }
}

On *nix can be done in bash, or scripting language if you prefer.

Just a suggestion.

note: untested

edit: accidentally used C-style comment
« Last Edit: August 24, 2011, 08:49:58 am by xzid »

Offline petermlm

  • Knight
  • **
  • Posts: 226
  • Cookies: 7
  • Information is Power
    • View Profile
    • Security Check
Re: File Organiser
« Reply #4 on: August 24, 2011, 04:39:01 pm »
With powershell you can do this very easily

Code: [Select]
# config
$src = "C:\old"
$dest = "C:\new"

# create the dirs
foreach($d in @($dest, "$dest\pics\", "$dest\vids\")) { mkdir $d }

# loop through all the files
ls -Recurse $src | % {
  switch($_.extension) {
    "jpg" { cp $_.fullname "$dest\pics\" }
    "png" { cp $_.fullname "$dest\pics\" }
    "avi" { cp $_.fullname "$dest\vids\" }
    # etc..
    # if has no extension, probably directory(not a vid/pic/music file for sure)
  }
}

On *nix can be done in bash, or scripting language if you prefer.

Just a suggestion.

note: untested

edit: accidentally used C-style comment

That is a start. Something like this should use a graphical interface, maybe working with Qt Framework or GTK. To make this work in more then one system but still efficient in terms of speed, that algorithm should first be ported into a language like C or C++. What do you think.

Offline xzid

  • Knight
  • **
  • Posts: 329
  • Cookies: 41
    • View Profile
Re: File Organiser
« Reply #5 on: August 24, 2011, 06:18:15 pm »
I think that scripting languages were invented because writting stuff like this in C is a pain in the ass, power shell was easiest implementation I could think of. Also not every program deserves gui.

Fuck DROID, this took 4eva to write.

Offline ElectricNoodle

  • Serf
  • *
  • Posts: 38
  • Cookies: 6
    • View Profile
Re: File Organiser
« Reply #6 on: August 24, 2011, 09:05:09 pm »
Hmmm some work to do then I think!!! :P

It does directory crawl of sorts.... After the initial folder selection, which can be just a folder... or even a whole drive, it will return a list of strings, that contain the path to every file found.

Cheers for all the ideas :P I would make it multi-os compatible.. but im only just starting out in linux, so wouldnt really know where to begin!!

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: File Organiser
« Reply #7 on: August 24, 2011, 09:45:31 pm »
<...>
Cheers for all the ideas :P I would make it multi-os compatible.. but im only just starting out in linux, so wouldnt really know where to begin!!
If it is VB you are doing then I am afraid you reached a dead-end where you cannot proceed to Linux :P

Offline ElectricNoodle

  • Serf
  • *
  • Posts: 38
  • Cookies: 6
    • View Profile
Re: File Organiser
« Reply #8 on: August 24, 2011, 09:51:38 pm »
Haha no no :P Its currently in Visual c# , so I suppose the same dead end is reached!! Although I do know some c++ ... maybe that would be the way to go!!

Offline xzid

  • Knight
  • **
  • Posts: 329
  • Cookies: 41
    • View Profile
Re: File Organiser
« Reply #9 on: August 24, 2011, 10:51:53 pm »
Haha no no :P Its currently in Visual c# , so I suppose the same dead end is reached!! Although I do know some c++ ... maybe that would be the way to go!!

This is scripting job, as you saw the recursive reading was simple in windows powershell [ls -Recurse]... In Linux run this command:

find ./mydir -name '*.*'

This will take alot of code in C++.

This type of thing falls under system administration, not programming. Which is another reason it shouldn't have a GUI.

A full program using bash(the unix version of powershell code)

Code: [Select]
mkdir ./dest ./dest/pic ./dest/vids
find ./src -name '*.*' | while read f; do case $f in
  *.jpg ) cp $f ./dest/pic/ ;;
  *.png ) cp $f ./dest/pic/ ;;
  *.avi ) cp $f ./dest/vids/ ;;
  # etc ..
esac; done

Once again, untested because I have no interest in doing this to my files.

If you're just starting out in linux, BASH is a must learn ASAP.
« Last Edit: August 24, 2011, 11:00:04 pm by xzid »