Evaluating if a file exists
Evaluating if a file exists
- Subject: Evaluating if a file exists
- From: email@hidden
- Date: Mon, 7 May 2007 13:08:29 -0400
I am having an issue when trying to
evaluate whether a file exists in specific directory or not. For some reason
the script evaluates the file name "PS00012.eps" and "PS0012.eps"
as being the same name. Here is the code and the apple event log entries.
on
open
(sourcefiles)
tell
application
"Finder"
set
theDestFolder
to
alias
"DONNELLY:Users:andrewd:Desktop:TheDestFolder:"
repeat
with
Currfile
in
sourcefiles
set
x
to
name
of
Currfile
set
folderList
to
list folder
theDestFolder
--put this in
for my sanity
if
not
(exists
file
(theDestFolder
& x
as
string))
then
duplicate
Currfile
to
theDestFolder
else
--things to do if the file exists
end
if
end
repeat
end
tell
end
open
-- started: open
{alias
"DONNELLY:Users:andrewd:Desktop:PS000012.eps"}
tell
application
"Finder"
get
name
of
alias
"DONNELLY:Users:andrewd:Desktop:PS000012.eps"
-->
"PS000012.eps"
list
folder alias
"DONNELLY:Users:andrewd:Desktop:TheDestFolder:"
-->
{
".DS_Store",
"Picture
2.jpg",
"Picture
3.jpg",
"PS0012.eps"
}
exists
file
"DONNELLY:Users:andrewd:Desktop:TheDestFolder:PS000012.eps"
-->
true
end tell
-- stopped
Any help offered is greatly appreciated.
Thank You
Andrew
--
_______________________________________________
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