Copy folders from PC to Laptop

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
simonwilliams
Newbie
Posts: 19
Joined: Tue Feb 20, 2007 9:43 am

Copy folders from PC to Laptop

Post by simonwilliams » Tue Feb 24, 2009 11:14 am

I'm trying to get Macro Scheduler to copy a folder from my main PC to my laptop.
I want it to completely delete the folder which will already be on the laptop every time it does this so that I have no duplicate files & everything is completely up to date.

However I am getting stuck on the 1st bit, copy folder. I just can't see anyway to copy a folder, only files. I have searched through this forum & what I'm wanting must be a pretty basic feature but no luck.

Any help appreciated. Thanks
Simon Williams

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 24, 2009 11:22 am

You can use CopyFile to copy a folder:

CopyFile>c:\foldername,m:\

That would copy the folder "foldername" and all its contents to the m: drive.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

simonwilliams
Newbie
Posts: 19
Joined: Tue Feb 20, 2007 9:43 am

Post by simonwilliams » Tue Feb 24, 2009 11:49 am

Thanks for the quick reply.

It works but its making a copy of the folder as it already exists.
How do I get it to delete the original folder & then paste it.

I don't want it to just overwrite the folder as this way old files will be left behind.

So far I have...

CopyFile>E:\My Documents\Leaflets,\\Laptop-advent\My Documents

Thanks again
Simon Williams

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 24, 2009 1:45 pm

MoveFile>E:\My Documents\Leaflets,\\Laptop-advent\My Documents
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

simonwilliams
Newbie
Posts: 19
Joined: Tue Feb 20, 2007 9:43 am

Post by simonwilliams » Tue Feb 24, 2009 2:46 pm

I've replaced

CopyFile>E:\My Documents\Leaflets,\\Laptop-advent\My Documents

With

MoveFile>E:\My Documents\Leaflets,\\Laptop-advent\My Documents

And now it won't do anything :?:
Simon Williams

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 24, 2009 3:02 pm

Ok, same thing would be:

CopyFile>E:\My Documents\Leaflets,\\Laptop-advent\My Documents
DeleteFile>E:\My Documents\Leaflets
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Tue Feb 24, 2009 4:00 pm

mtettmar wrote:You can use CopyFile to copy a folder:

CopyFile>c:\foldername,m:\

That would copy the folder "foldername" and all its contents to the m: drive.
Hi Marcus,

The above ability is great, but the entry in the Help File only talks about copying files:
Help File wrote:CopyFile

CopyFile>sourcefile,destinationfile

Copies the file (or files), sourcefile, to destinationfile

sourcefile, and destinationfile may be variables. Wildcards can be used.

By default if destinationfile already exists it will not be overwritten and the new file will be renamed appropriately. It is possible to change the bahaviour of the CopyFile command to overwrite instead by setting CF_OVERWRITE to 1. The default value of CF_OVERWRITE is 0.

Abbreviation : Cop
See also : MoveFile, DeleteFile, IfFileExists, AppendFile, RenameFile

Example

CopyFile>c:\temp\myfile.txt,c:\my documents\myfile.old

Or with variables:

Let>filename=c:\temp\myfile.txt
Let>newfilename=c:\temp\myfile.new
CopyFile>filename,newfilename
Could you possibly update the Help File to say that directories can also be copied and provide an example? That would be helpful.

Same thing for MoveFile> and possibly other commands?

Its just my opinion... but if the command can handle directories as well as files, I think the Help File should say so.

Also change typo bahavior to behavior.

Thanks for listening... and keep up the great work on the product and the support here on the forums.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Feb 24, 2009 4:25 pm

Will do.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

simonwilliams
Newbie
Posts: 19
Joined: Tue Feb 20, 2007 9:43 am

Post by simonwilliams » Tue Feb 24, 2009 4:43 pm

Thanks for that, works a charm :-)
Simon Williams

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts