• 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: I made a nightmare
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I made a nightmare


  • Subject: Re: I made a nightmare
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 09 Dec 2015 19:29:16 +0100

Here is the true script.

set sourceFolder to choose folder

--set sourcefolder to (path to desktop as text) & "formoosmahna:" as alias
--set keyName to "staff_01"

set keyName to text returned of (display dialog "Type a folder name" default answer "Staff_01")

tell application "System Events"
set theSubFolders to folders of sourceFolder
repeat with aSubfolder in theSubFolders
set itsFiles to (files of aSubfolder whose visible is true)
if itsFiles is not {} then
set movableFiles to {}
repeat with aFile in itsFiles
if name of aFile contains keyName then set end of movableFiles to contents of aFile
end repeat
if movableFiles is not {} then
set dest to (path of aSubfolder as text) & keyName & ":"
if not (exists folder dest) then
make new folder at end of aSubfolder with properties {name:keyName}
end if


set posixDest to my quoteIt(dest)
repeat with aFile in movableFiles
set qSource to my quotePOSIXit(path of aFile)
do shell script "mv " & qSource & space & posixDest
end repeat
end if
end if
end repeat
end tell # System Events

on quotePOSIXit(aPath) # really useful for the POSIX part
return quoted form of POSIX path of aPath
end quotePOSIXit


Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mercredi 9 décembre 2015 19:28:19


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

This email sent to email@hidden

References: 
 >I made a nightmare (From: Yvan KOENIG <email@hidden>)
 >Re: I made a nightmare (From: Axel Luttgens <email@hidden>)
 >Re: I made a nightmare (From: Yvan KOENIG <email@hidden>)
 >Re: I made a nightmare (From: Christopher Stone <email@hidden>)
 >Re: I made a nightmare (From: Yvan KOENIG <email@hidden>)
 >Re: I made a nightmare (From: Christopher Stone <email@hidden>)
 >Re: I made a nightmare (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: I made a nightmare
  • Next by Date: Re: I made a nightmare
  • Previous by thread: Re: I made a nightmare
  • Next by thread: Re: I made a nightmare
  • Index(es):
    • Date
    • Thread