Link to home
Start Free TrialLog in
Avatar of Tina_Bhole
Tina_Bhole

asked on

Tool to automatically copy files and folder to differnt locations on computer

Hi Experts,

Would like to know if there is any tool available to copy the files and folders at different locations?

I am looking for a solution what wil work in windows XP, Vista and Windows 7

Currently I am doing this using a batch file, but when it comes to copying files or folders to Program Files or Program Files (x86), I get a message "Access Denied".

To explain this further, my folder structure is as follows:

         masterfolder  
                  - submasterfolder1
                              - file1
                              -file 2
                  -sub masterfolder2
                             - sub-subfolder1
                             -subsubfolder2
                  - myprogram.dll


So, I need to copy files and folder form the masterfolder at different locations on my computer. Is there any way to automate this? through msi or with better batch file code?

Could someone please suggest a work around for this?


Thanks in advance.
Avatar of Kruno Džoić
Kruno Džoić
Flag of Croatia image

you can try and use Cobian backup

http://www.cobiansoft.com/index.htm
Avatar of Ashok Dewan
Yes, Cobian backup tool is free and it can easly copy your files and folders to different location daily as you schedule.

visit here :- http://www.cobiansoft.com/
Avatar of mo_patel
mo_patel

in your cmd line, rather than using xcopy use robocopy cmds.

This is alot better and stable than using the windows std copy commands.
I use syncback

http://www.2brightsparks.com/syncback/index.html

it's possible to execute on event, planified or when you close windows
Try running your batch file as administrator. It works for me.
Avatar of Tina_Bhole

ASKER

Hi All,

Thanks for your input.
Considering all the options, I think batch file is best option amongst all, the only thing I have to figure out is, how do I bypass the "Access Denied" message when I try to copy in Program Files  or Program Files (x86) folder.

This "Copying of files" is part of the installation process for my program, which looks for those specific files in the specified folders.
This has to be done only once so, I don't think cobian backup tool could not be  the best option for this, as this will have to be installed on client's computer first before starting to copy the files at desired locations.

Any other suggestions please?
I did try running as administrator, but it didn't help. I am still getting an Access Denied message
Assuming you ran in elevated privileges as administrator correctly, then it sounds like you are trying to copy over a file that is currently loaded or in use.  I see that you may have one or more DLL files, and they can sometimes create a problem like this.  Are the files already there that you are trying to overwrite, or are you copying files that do not currently exist.

Can you post the script you are currently running when you get the access denied error?

~bp
I am logged in as an administrator and also, the files which I am trying to copy do not already exist. This is the first time installation process which I am trying to achieve.

My batch file looks like this:

ROBOCOPY "masterfolder" "C:\Program Files/ My Program" /MIR

IF EXIST "C:\Program Files (x86)" (ROBOCOPY "Program" "C:\Program Files (x86)\Common Files\Prog Shared\My Program\Components\") ELSE (ROBOCOPY "Program"  "C:\Program Files\Common Files\Prog Shared\My Program\Components\" )

I am getting Access Denied each time.


These commands work on other folders  (i.e.,  my documents folder) but not in Program Files folder
The fact that you are logged-on as a local admin, it has nothing to do with the "elevated privileges as administrator" previously discribed be BillPrew.

Please collaborate further.

Cheers,
Rene
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi billprew,

I did try that as well. Still no luck.
FYI: I am running on Windows 7
Odd.  Can you post up the output from ROBOCOPY?

~bp
http://www.runtime.org/shadow-copy.htm

Uses vss to copy files.

Just set it up to use windows scheduler.

http://windows.microsoft.com/en-US/windows7/schedule-a-task

A no brainer!
You are running into the problem of the protected folders.. Currently only 'TrustedInstaller' has full priviledges on the folder in question.

Since you are not using a 'installer' to install the product you have to takeownership of the folder in question:
takeown /f c:\program files(x86)\myfoldername
once you do this then you should be able to copy the files without a hitch.
Hi billprew,

Thanks for your response.
I don't know what I did wrong last time, but I tried it again and its working now.
You were right, I had to start the command propt with Admin right for the batch file to work.
Great, glad that worked out, thanks for the feedback.

~bp