I need help with this script. I need to copy pdf files from one folder to differnet sub folders in another folder. The file names will be wta, wtb, wtc, gta, gtb, gtc. The common letter will be A, B, C, D, E, F. But when it gets down to D it will copy all files since they are pdfs rather than just copy the ones named wtd.pdf or gtd.pdf
Any help would be greatful.
Thanks
– Get todays month
set themonth to month of (current date)
– Get todays year
set theYear to year of (current date)
–Get today’s day
set WDay to weekday of (current date) as text
– Selecting the day Folder if it is less than 10 it adds a 0 in front
if day of (current date) is less than 10 then
set theDay to “0” & day of (current date)
else
set theDay to day of (current date) as text
end if
– Set the folder names
set the_folders to {“ASection”, “BSection”, “CSection”, “DSection”, “ESection”, “FSection”} as list
set theSource to alias “Macintosh HD:Users:comp1:Desktop:Test 1:”
– Selecting the Month Folder
if month of (current date) is March then
set theInput to "03 " & themonth & " " & theYear
else if month of (current date) is April then
set theInput to "04 " & themonth & " " & theYear
else if month of (current date) is May then
set theInput to "05 " & themonth & " " & theYear
else if month of (current date) is June then
set theInput to "06 " & themonth & " " & theYear
else if month of (current date) is July then
set theInput to "07 " & themonth & " " & theYear
else if month of (current date) is August then
set theInput to "08 " & themonth & " " & theYear
else if month of (current date) is September then
set theInput to "09 " & themonth & " " & theYear
else if month of (current date) is October then
set theInput to "10 " & themonth & " " & theYear
else if month of (current date) is November then
set theInput to "11 " & themonth & " " & theYear
else if month of (current date) is December then
set theInput to "12 " & themonth & " " & theYear
else if month of (current date) is January then
set theInput to "01 " & themonth & " " & theYear
else if month of (current date) is February then
set theInput to "02 " & themonth & " " & theYear
end if
tell application “Finder”
activate
with timeout of 600 seconds
if not (exists folder theInput of disk “PDF Archive”) then make new folder of disk “PDF Archive” with properties {name:theInput}
if not (exists folder theDay of folder theInput of disk “PDF Archive”) then make new folder of folder theInput of disk “PDF Archive” with properties {name:theDay}
repeat with i from 1 to number of items in the_folders
make new folder at folder theDay of folder theInput of disk “PDF Archive” with properties {name:item i of the_folders}
end repeat
set These_FilesA to (files of folder theSource whose name contains “A”)
set These_Filesb to (files of folder theSource whose name contains “B”)
set These_Filesc to (files of folder theSource whose name contains “C”)
set These_Filesd to (files of folder theSource whose name contains “D”)
set These_Filese to (files of folder theSource whose name contains “E”)
set These_Filesf to (files of folder theSource whose name contains “F”)
duplicate These_FilesA to folder "ASection" of folder theDay of folder theInput of folder "PDF Archive"
end timeout
empty trash
end tell