Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2012-09-13
17
Medium Priority
?
717 Views
Last Modified: 2012-09-16
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.
0
Comment
Question by:Tina_Bhole
  • 5
  • 4
  • 2
  • +6
17 Comments
 
LVL 11

Expert Comment

by:Kruno Džoić
ID: 38393870
you can try and use Cobian backup

http://www.cobiansoft.com/index.htm
0
 
LVL 9

Expert Comment

by:Ashok Dewan
ID: 38393873
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/
0
 
LVL 6

Expert Comment

by:mo_patel
ID: 38393903
in your cmd line, rather than using xcopy use robocopy cmds.

This is alot better and stable than using the windows std copy commands.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 6

Expert Comment

by:Manuel Marienne-Duchêne
ID: 38393967
I use syncback

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

it's possible to execute on event, planified or when you close windows
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 38395837
Try running your batch file as administrator. It works for me.
0
 

Author Comment

by:Tina_Bhole
ID: 38397186
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?
0
 

Author Comment

by:Tina_Bhole
ID: 38397191
I did try running as administrator, but it didn't help. I am still getting an Access Denied message
0
 
LVL 59

Expert Comment

by:Bill Prew
ID: 38397267
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
0
 

Author Comment

by:Tina_Bhole
ID: 38397365
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
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 38397387
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
0
 
LVL 59

Accepted Solution

by:
Bill Prew earned 1000 total points
ID: 38397389
It's not enough to be logged in as an administrator, you must run the BAT with elevated privs.

Do Start, All Programs, Accessories, then right click on Command Prompt and select Run as Administrator.  This will open a command prompt window after you allow elevated access.  Run the BAT file from that command line and see if it works.

~bp
0
 

Author Comment

by:Tina_Bhole
ID: 38397424
Hi billprew,

I did try that as well. Still no luck.
FYI: I am running on Windows 7
0
 
LVL 59

Expert Comment

by:Bill Prew
ID: 38397428
Odd.  Can you post up the output from ROBOCOPY?

~bp
0
 
LVL 30

Expert Comment

by:pgm554
ID: 38397533
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!
0
 
LVL 84

Expert Comment

by:David Johnson, CD, MVP
ID: 38398250
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.
0
 

Author Closing Comment

by:Tina_Bhole
ID: 38404103
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.
0
 
LVL 59

Expert Comment

by:Bill Prew
ID: 38404129
Great, glad that worked out, thanks for the feedback.

~bp
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question