This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

OOT: C & file-archieving

Hi All,,

Its a way off topic question from the list, with the hope that ppl here would not take it offensive, I appologize in advance.

I am writing a C program for my computer . The system() command in C can used to run OS commands at runtime from the program. What i am looking for is some way by which i can convert a whole directory (and its subdirectories) into a single file.

If anyone has done this before or has any idea how to go about doing this , then i would be happy to know that.

One obvious way to do that is use winzip to make a .zip file of a directory. But i dont know how to run a windows application from C program.

Any suggestion would be great.

Thankzz && Bye
-Rocknmoon

  • You can download a command line thing for winzip at the winzip site. I am using this for years now. I have written a dos batch file that queries if I want to archive e.g. all my C51 stuff or my project directory etc. I usually run it at the end of the day and this way, everything I have changed while the day is updated in or added to the zip-file that I use for that directories. Then I copy it to the file server. This way, I have 2 copied of my files and it is also pretty simple to burn it on CD-ROM. The file for the commandline option of winzip is called wzbetacl.exe.

  • The file Archive Attribute is very useful for this; it can be used with WinZip, and the original command-line PKZIP, and XCOPY, etc, etc

    The command

    XCOPY /s /m *.* dest
    will copy all changed files (including in sub-folders) & then clear the Archive Attribute.
    Use /a instead of /m if you don't want the Archive Attribute cleared (eg, if you also have some system backup or other stuff which relies upon it).

    I usually precede this with a Batch file which does things like
    ATTRIB -a *.bak /s
    ie, clear the Archive Attribute on all .bak files - so that the "junk" doesn't get copied.

  • Thanks for all the explanations.

    Andrew & Sven would you be kind enough to send me your sample batch files ??

    Thanks in advance.

    rocknmoon@yahoo.com