1/ move all files from “folderA” to “folderC”
2/ move all files from “folderB” to “folderC”
3/ delete in “folderC” all files that are more then 30 days old
4/ delete in “folderC” all files that are less then 20Mb
5/ delete all files that are not video (.mov)
5/ empty trash
6/ wait 30 seconds
7/ move files from “folderC” to “folderA”
this script should work on Mac os X10.5 (apple script 2.0.1) and 10.6
all the best,
Thomas
Model: imac
AppleScript: last
Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)
assuming 5) affects also only files of folder C try this,
there might be a problem if files in folder A and folder B have the same name.
Adjust the paths in the property lines, save the script as application bundle and add it to login items
property folderA : "MacHD:Users:myUser:Desktop:folderA:"
property folderB : "MacHD:Users:myUser:Desktop:folderB:"
property folderC : "MacHD:Users:myUser:Desktop:folderC:"
tell application "Finder"
move items of folder folderA to folder folderC
move items of folder folderB to folder folderC
delete (every file of folder folderC whose modification date is less than ((current date) - 30 * days))
delete (every file of folder folderC whose size is less than (20 * (10 ^ 6)))
delete (every file of folder folderC whose name extension is not "mov")
end tell
delay 30
tell application "Finder" to move items of folder folderC to folder folderA
I modified StefanK’s code for something I thought would be more efficient (no offense to StefanK) he is a great coder
no need for folder c just remove the crap you don’t want then only move files you want to keep
set dt to path to desktop
set folderA to "" & dt & "folderA:"
set folderB to "" & dt & "folderB:"
tell application "Finder"
delete (files of folder folderA whose modification date is less than ((current date) - 30 * days) or size is less than (20 * (10 ^ 6)) or name extension is not "mov")
delete (files of folder folderB whose modification date is less than ((current date) - 30 * days) or size is less than (20 * (10 ^ 6)) or name extension is not "mov")
move items of folder folderB to folder folderA
end tell
thanks for your input Mc Grailm but I actually need this moving from A to C to A.
I have a folder action script that load media into my interactive program (Isadora) from folderA. But it work only if media are droped into it…
So I need this little moving around.
I tested it, added the :
tell application “Finder”
empty the trash
delete (every file of folder folderC whose name extension is not "mov")
was ment to delete all the corrupted .mov filles produced by my interactive programe (10% of the filles are not well produced, have a .mov extention but are not reconized and played by quicktime).
But it does not work because they are .mov eventhaught they are not playable video (The finder does not show their icone as a film image for exemple).
Do you have an idea how to go around this problem?
I post an exemple of corruped fille on this adress: http://www.thomasisrael.be/temp/corruptedmovfile.mov
The last move to FolderA is ment to activate a “folder action script” witch load all the movies placed in folderA into my interactive program. On OS X 10.5, ones a folder action script is activated, it stayes activated even after a computer reboot. On OS X 10.4 it seems to not memorize this activation of the Folder Action Script.
I tries a piece of script I found to activate a folder action script at start up :
tell application "System Events"
set enabled of (script "isadora-dropload" of folder action folderA) to true
end tell
but it does not work…(error message: NSReceiverEvaluationScriptError: 4)
do you have an idea how to solve that?
try to check the dimensions of the track. If an error occurs then the file is corrupted
property folderA : "MacHD:Users:myUser:Desktop:folderA:"
property folderB : "MacHD:Users:myUser:Desktop:folderB:"
property folderC : "MacHD:Users:myUser:Desktop:folderC:"
tell application "Finder"
move items of folder folderA to folder folderC
move items of folder folderB to folder folderC
delete (every file of folder folderC whose modification date is less than ((current date) - 30 * days))
delete (every file of folder folderC whose size is less than (20 * (10 ^ 6)))
repeat with oneFile in (get every file of folder folderC)
if my checkQTFile(oneFile as text) is false then
delete contents of oneFile
end if
end repeat
end tell
delay 30
tell application "Finder" to move items of folder folderC to folder folderA
on checkQTFile(filePath)
tell application "System Events"
set qFile to QuickTime file filePath
try
get 1st track of contents of q whose dimensions is not {0.0, 0.0}
return true
on error
return false
end try
end tell
end checkQTFile
to enable the folder action script the reference folder action must be just the name of the folder, not the full path
When I move the files, I would like to choose “Keep Both” when the error says “Do you want to replace the files with the same name.” How do I do that?
Also, I want to delete the files in Folder A Whose first 6 letters of the name (digits) add up to more than 100000, then move the rest to another folder.
Here’s my script: