Jump to content
Server Maintenance This Week. ×

copy all files from one folder & paste all files into another folder overwriting same files


This topic is 4979 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello ,

By using Applescript script step i want to copy all files from folder name "anj"(Folder name is constant)which is onto Public folder & paste all files into another folder having name "anj" which is in Library folder .if any file is existing then without giving any message it will overwrite that file.

Thanks,

Link to comment
Share on other sites

Disclaimer: Overwriting files with no warning is a little dangerous. You are responsible for what happens (not me).

It will however only overwrite matching files, so pretty safe (as these things go).

The following will create the "anj" folder in the user Library folder. And it will move files from the user Public folder. If you want to use the computer level folders then follow the directions in the comments. Curiously the defaults are opposite on the two folders, so you have to add or remove a phrase to switch levels (there is also a system level, stay away from that).

You could add an alert to tell you if there's no files in the Public folder to move. But likely you don't care.

set pub to (path to public folder) as text

-- default is user Public folder (add "from local domain" for computer Library folder)

set pub_anj to pub & "anj"

set lib to (path to library folder from user domain) as text

-- default is computer Library folder (remove "from user domain")

set lib_anj to lib & "anj"

tell application "Finder"

if not (exists folder lib_anj) then

make new folder at lib with properties {name:"anj"}

end if

move files of folder pub_anj to folder lib_anj with replacing

end tell

Link to comment
Share on other sites

This topic is 4979 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.