Click here to Skip to main content
13,052,022 members (63,367 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello Friends
I am VB.NET Programmer and currently working on a project where i have to copy the rar/zip file from any folder.
While pasting it, it should extract the rar/zip contents automatically.
I am done with my extracting part but

Here are some problems i am facing

Problem 1 : How should i detect that a rar/zip file is copied by the system ?

Problem 2 : How to track the file in which it has to be paste ?
All operation will be done from system context menu.

Kindly Help me Thank You
Posted 4-Mar-13 0:47am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

RAR is proprietary; I would not advise to use it, but — please see below, you can always un-RAR.

Problem 1:

If you really need to detect the event like that, it may mean that your architecture seriously needs rethinking. If you still think you need go this way, the solution is to use the class System.IO.FileSystemWatcher:[^].

It's use can be problematic though; please see these CodeProject articles:
FileSystemWatcher - Pure Chaos (Part 1 of 2)[^],
FileSystemWatcher - Pure Chaos (Part 2 of 2)[^].

I would not advise you to get into it but would rather advise to review the architecture, but decide by yourself; I don't know your goals. (That's why this is a good idea to share them first when asking your questions.)

To work with just ZIP, you can use #ziplib:[^].

Another option is using SevenZipSharp, a .NET wrapper of the famous 7-Zip:[^],[^].

7-zip does support ZIP, RAR and a lot more.

Both libraries are open-source.

Problem 2:

It does not seem to make sense. Compression is not related to Past. If your code pastes, you don't need to "track" anything, your call can trigger whatever you want. If you want to capture Paste event, you need to understand what are you pasting; again, it has nothing to do with file compression. Perhaps I did not understand this part, but you certainly did not explain it properly.

Kumar_G 7-Mar-13 7:56am
I want to know how does the system knows that a rar/zip file has been copied ?
So that i can implement in my context menu
As I explained, FileSystemWatcher. Is that clear now?

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 4 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100