Go Back   The macosxhints Forums > OS X Help Requests > AppleScript



 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
Old 05-13-2012, 09:51 PM   #1
am04
Prospect
 
Join Date: May 2012
Posts: 1
Unhappy Help with copy files/create text file of missing files

Hi guys,

I've got a script that copies files from one folder to another based on a .txt file, which works perfectly... except I'd like for it to tell me what files (if any) have not been copied (ie. they probably were not in the folder to start with) - I've been trying to get it to put that information into a text file.

I can create my text file ok (but, with nothing in it!), and copy the files ok, but am struggling to get them to work together. If possible, I'd also like for the dialogue at the end to tell me that it has copied x (number of files copied) of y (number of files in .txt file - not folder)

Pretty new to applescript, so any suggestions would be appreciated! Thank you!

My current script is as follows:

set theTextItems to paragraphs of (read (choose file with prompt "Choose a list of files") as «class utf8»)
set theSourceFolder to (choose folder with prompt "Choose original art folder") as string
set theDestination to (choose folder with prompt "Choose destination folder")
repeat with thePDFName in theTextItems
try
set thePDFFile to (theSourceFolder & thePDFName)
if thePDFFile = theSourceFolder then
display dialog "Encountered an empty item" buttons {"OK"}
else
tell application "Finder" to duplicate alias thePDFFile to theDestination with replacing
end if
end try
end repeat


tell application "Finder"
tell folder theDestination to set theCount1 to (count of items) as string
end tell
set theCount2 to (count of theTextItems) as string
display dialog (theCount1 & " of " & theCount2 & " items copied to " & theDestination) buttons {"OK"}
am04 is offline   Reply With Quote
 

Tags
.txt, copy, error, file, missing

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 04:17 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.