Hi there,
This (small part) of a script is giving me a headache.
It creates a subfolder and than moves the content of the folder to the subfolder.
No rocket-science so far. But now comes the strange thing.
The script fails when there is only one file in the folder???
More then one file and it works like a charm.
What am I doing wrong?
Help me please !!!
Erwin
on open draggedItems
repeat with oneFolder in draggedItems
set hoofdMap to oneFolder as string
set subMap to hoofdMap & "aangeleverd:"
tell application "Finder"
try
make new folder at (hoofdMap as alias) with properties {name:"aangeleverd"}
on error
display dialog "De map 'aangeleverd' bestaat al!"
end try
set theFiles to every file of entire contents of (hoofdMap as alias)
repeat with aFile in theFiles
set fileToCopy to hoofdMap & (name of aFile)
set destinationFolder to subMap
move fileToCopy to destinationFolder
end repeat
end tell
end repeat
end open