Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Move every other file to a new folder




On 26 Jun 2006, at 02:39, Bryan Mumford wrote:

I'm new to Applescript. I need to move every other file in a folder to a different folder, to reduce the number of files (sequential photographs) in the original folder. Can Applescript do this? Any advice on getting started?

If you just want to move half of the files to another folder, Bryan, then try:


------------------

set source_folder to choose folder with prompt "Choose a source folder:"
set target_folder to choose folder with prompt "Choose a target folder:"

tell application "Finder" to tell folder source_folder to if (count files) > 1 then ¬
move (files from file after middle file to last file) to target_folder


------------------

To move alternate files, perhaps something like this:

------------------

set source_folder to choose folder with prompt "Choose a source folder:"
set target_folder to choose folder with prompt "Choose a target folder:"

tell application "Finder" to set l to source_folder's files
repeat with i from 1 to (count l) by 2
	set l's item i to false
end repeat
tell application "Finder" to move l's references to target_folder

------------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Move every other file to a new folder (From: Bryan Mumford <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.