Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I was implemented the class library with copying from source directory to target directory (which contains asp.net web application tasks)including sub directories.

My new requirement is restrict some file to copy from source to target(eg:.exe files) and delete the files those are not available in my target.


Eg:

before copy:
source- 1.txt, 2.txt,3.exe,4.aspx
target-1.txt, 6.txt 5.exe, 7.aspx

after copy:
source- 1.txt, 2.txt,3.exe, 4.aspx
target-1.txt, 2.txt,4.aspx(3.exe restricted to copy, 6.txt 5.exe, 7.aspx have to delete)
Posted
Updated 7-Aug-13 2:18am
v2
Comments
Maarten Kools 7-Aug-13 6:09am    
Maybe you should ask the person/company who gave that task to you to clarify?

Instead of re-inventing the wheel, use robocopy with /MIR parameter.
 
Share this answer
 
Comments
Naga Sindhura 7-Aug-13 7:49am    
Hi, through command prompt it's working fine, however i wanted to restrict some files like .exe from source to target. How can we do this using robocopy.
Bernhard Hiller 7-Aug-13 8:47am    
There are more parameters, e.g. for excluding specific files.
Use Beyond Compare...

http://www.scootersoftware.com/index.php[^]

It can compare entire folders, shows missing files and also textual differences...

The best tool i ever encountered for this purpose...
 
Share this answer
 
v2
Comments
Naga Sindhura 7-Aug-13 8:47am    
i wanted to implement this one using c# or dos command.
Srinivas Kalabarigi 7-Aug-13 8:53am    
Do you want text comparison as well or just file names?
Naga Sindhura 7-Aug-13 9:39am    
for this requirement not needed.
Srinivas Kalabarigi 7-Aug-13 10:21am    
Then your requirement can be achieved by automated tools ... like Repliweb, robotcopy, etc. if your company wants to purchase.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900