Moving files from 1 folder into 2 sub-folder depending on extention

Hello,

I have been trying to create a script that I could use with Graphic Converter to move .arw and .jpg file into two subfolders. The script create the subfolders but won’t move the files . it says system error -1753. What have I done wrong ?


property _subfolder_arw : “ARW”
property _subfolder_jpg : “JPG”

tell application “Finder”
set _slidefolder to choose folder

set _subfolder to make new folder at _slidefolder with properties {name:_subfolder_arw}
set _subfolder to make new folder at _slidefolder with properties {name:_subfolder_jpg}
if files of the folder whose name extension is "arw" then
	move files to _subfolder_arw
else
	
	move files to _subfolder_jpg
end if

end tell


Hi petri,

The line:

files of the folder whose name extension is “arw”

returns a list while the if/then statement needs a boolean value. Just use this:

tell application “Finder”
move (files of folder f whose name extension is “pdf” or name extension is “arw”) to desktop
end tell

and remove the if/then statements.

Edited: in your case you would need to move commands for each extension.

gl,

thanx Kel,

but I am sorry I don’t get it, (newbie as I am)

I would like the arw files to move to the just created ARW subfolder and the jpg files to the JPG subfolder

I don’t understand your desktop line… sorry

Hi petri,

try this

property _subfolder_arw : "ARW"
property _subfolder_jpg : "JPG"

tell application "Finder"
	set _slidefolder to choose folder
	
	set ARWfolder to make new folder at _slidefolder with properties {name:_subfolder_arw}
	set JPGfolder to make new folder at _slidefolder with properties {name:_subfolder_jpg}
	move (get files of _slidefolder whose name extension is "arw") to ARWfolder
	move (get files of _slidefolder whose name extension is "jpg") to JPGfolder
end tell

Hi petri,

Sorry, I thought you already knew how to use ‘move’. Mine was just my example that uses the proeprty ‘desktop’ as a reference.

gl,

thanx Stefan,

it works perfectly.