set source to (path to desktop folder as text) & "A:"
set destination to (path to desktop folder as text) & "B:"
tell application "System Events"
set lesNoms_theNames to name of files of folder source whose visible is true
end tell
repeat with unNom_aName in lesNoms_theNames
set clef_key to text 1 thru 5 of unNom_aName
if clef_key is in {"AAAAA", "BBBBB", "CCCCC"} then
set orig to quoted form of POSIX path of (source & unNom_aName)
set target to quoted form of POSIX path of (destination & clef_key)
do shell script "mv " & orig & space & target
end if
end repeat
is supposed to do the job.
Yvan KOENIG (VALLAURIS, France) dimanche 3 novembre 2013 18:39:04
try this, sourceFolder is folder A, destinationFolder is folder B
set sourceFolder to choose folder
set destinationFolder to choose folder
tell application "Finder"
repeat with aFolder in (get folders of destinationFolder)
set folderName to name of aFolder
set filesToMove to (files of sourceFolder whose name begins with folderName)
move filesToMove to (contents of aFolder)
end repeat
end tell
I’ve been trying to set a custom path manually instead of having a “choose folder” prompt. I’ve tried so many different ways, but none work. How do I do that?
set sourceFolder to "/Users/JPCanaverde/Documents/A"
set sourceFolder to "SSD:Users:JPCanaverde:Documents:A"
set sourceFolder to alias "SSD:Users:JPCanaverde:Documents:A"
set destinationFolder to alias "SSD:Users:JPCanaverde:Documents:B"
tell application "Finder"
repeat with aFolder in (get folders of destinationFolder)
set folderName to name of aFolder
set filesToMove to (files of sourceFolder whose name begins with folderName)
move filesToMove to (contents of aFolder)
end repeat
end tell