• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Move every other file to a new folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Move every other file to a new folder


  • Subject: Re: Move every other file to a new folder
  • From: kai <email@hidden>
  • Date: Mon, 26 Jun 2006 05:02:46 +0100


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: This email sent to email@hidden
References: 
 >Move every other file to a new folder (From: Bryan Mumford <email@hidden>)

  • Prev by Date: Re: Intel UI scripting
  • Next by Date: Re: Intel UI scripting
  • Previous by thread: Move every other file to a new folder
  • Next by thread: Re: Move every other file to a new folder
  • Index(es):
    • Date
    • Thread