Copying to a folder based on year
Posted: Sat Nov 13, 2021 7:12 pm
I've created a rule that renames files based on content, including the year and month. I want to copy these files to a network folder into a subfolder that is named for the year in the filename.
After doing a fair bit of digging, I came up with this embedded script:
When I run it, I'm getting AppleScript time-out errors in the log. In the testing I'm doing, the folder actually exists for the year in question.
I'd appreciate feedback on where I'm going wrong.
Thanks,
Des
After doing a fair bit of digging, I came up with this embedded script:
- Code: Select all
set report_year to item 1 of inputAttributes
tell application "Finder"
try
set thisPath to "/Volumes/Private/Scanned CHEQUES/1 MONTHLY CHEQUE SUMMARIES/"
set fullPath to thisPath & report_year as text
if not (exists fullPath) then
set y to make new folder at thisPath with properties {name:report_year}
end if
activate
open y
copy file theFile to folder fullPath
end try
end tell
When I run it, I'm getting AppleScript time-out errors in the log. In the testing I'm doing, the folder actually exists for the year in question.
I'd appreciate feedback on where I'm going wrong.
Thanks,
Des