Author Topic: sorting files  (Read 3882 times)

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4456
  • just a number
sorting files
« on: September 06, 2014, 02:28:44 AM »

say i want to sort 1000 files into 5 specific folders based on their extension (i.e. part of their file name), for example sit, zip, dmg, toast, and "other".

how would you go about that?

i suppose it can easily be done with applescript, but i dont really know where to start. however i would like to avoid php or perl or such bullshit.

the best option would be an app which does it.

insert arbitrary signature here

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4456
  • just a number
Re: sorting files
« Reply #1 on: September 06, 2014, 02:40:27 AM »

hm ok, i could rename them using file manipulator: file.sit contains .sit and therefore would be renamed to 3file.sit. then i can sort alphabetically in a finder window and move by hand. afterwards i just remove the frist character.

but this isnt perfect, as it stops working for filenames of 32 characters length.

maybe there is a tool which lets you reverse filenames?

insert arbitrary signature here

Offline MacTron

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2116
  • keep it simple
Re: sorting files
« Reply #2 on: September 06, 2014, 02:51:49 AM »

hm ok, i could rename them using file manipulator: file.sit contains .sit and therefore would be renamed to 3file.sit. then i can sort alphabetically in a finder window and move by hand. afterwards i just remove the frist character.

but this isnt perfect, as it stops working for filenames of 32 characters length.

I guess you know this, but incase you don't realize: If all of them are in the same folder and has its file attributes set correctly... you can set list view and click on kind tab, all the files of the same kind remain together, then it is easy to select by kind ...


Otherwise... AppleScript. I'm not a fan of it, but in a few minutes you'll make the script you need, I guess.

Quote
maybe there is a tool which lets you reverse filenames?
You can try "MP3 Rage" it is for .mp3 but I've done some weird things with it :)
Please don't PM about things that are not private.

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4456
  • just a number
Re: sorting files
« Reply #3 on: September 06, 2014, 03:06:05 AM »

right, type is of course in the list view, i forgot about that. :)

but the type might be missing or different from the extension, so i had to set the type based on the name first (which is not a problem)

nevertheless ... i would like to learn about new ways how to move or copy files automatically based on conditions.

will look into script editor again. (normally thats an automator job, hu? but i want to have it in OS9.)
insert arbitrary signature here

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4456
  • just a number
Re: sorting files
« Reply #4 on: September 06, 2014, 03:19:10 AM »
with the help of google ...

Code: [Select]
tell application "Finder"
set this_folder to "path:to:Unsorted:"
set this_list to every file of this_folder
repeat with i in this_list
if name of i does end with ".sit" then
move i to "path:to:Sit-Files:"
end if
end repeat
end tell

not tested yet.

and how do i add drag and drop?

and why does the thing deal with "i" after no variable has been defined? :)
insert arbitrary signature here

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4456
  • just a number
Re: sorting files
« Reply #5 on: September 06, 2014, 06:29:24 AM »

it´s almost done.

lolz.

Code: [Select]
beep 2
say "dididadadududomm domme dididadadududomm domme ayne domme ayneedoum babaumboumshsh shutzs f babaumboumshsh shutzs f babaumboumshsh shibibibibididee " using "Zarvox"
beep 2
insert arbitrary signature here