How can I cause the datetime to be the name of the output file.....



Hello everyone,


I realize that I'm new to the group, but I'm hoping that someone might
be able to help me out. What I'm doing is using the GNU 7zip command
line utility to make a backup on my desktop. Essentially, I'm running
an executable that will create a folder, and drop a zipped up copy of
my data to that folder. There doesn't seem to be a way to get 7zip to
automatically create a file where the filename.zip would be a date/time
stamp (something like 020206143260.zip.

What I'd like to be able to do is allow 7.zip to create the file with
some arbitrary name, and then use the rename() function and the time.h
library to somehow grab the current date/time from the computer and
rename the file with the filename being the date/time stamp.

Would time.h be the right library to use? If so, does anyone have any
suggestions as to how a solution might be implemented? Any thoughts
would be greatly appreciated.

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>


main()
{

chdir("C:\\Documents and Settings\\All Users\\Desktop\\");
mkdir("Backup");
chdir("C:\\Program Files\\Backup Utility\\");
system("7za.exe a -tzip \"C:\\Documents and Settings\\All
Users\\Desktop\\Backup\\Backup.zip\" \"C:\\Program
Files\\Data\\*.*\"");
chdir("C:\\");

}

Thanks for reading! I've been stumped on this one as I'm relatively
new to C (and programming in general.)

Once again, any help is greatly appreciated.

.



Relevant Pages

  • Re: Change folder date
    ... You can change the last modified date to the current date/time by creating ... and deleting a temp file within the folder. ... Microsoft® Windows®2000 Scripting Guide ... WSH 5.6 documentation download ...
    (microsoft.public.scripting.vbscript)
  • Re: e-mails from Sent folder display no date when moved
    ... > showing the send date/time and the Deleted items folder showing the received ... > Delete mail from Deleted Items older than 20 days. ...
    (microsoft.public.mac.office.entourage)
  • Volume Leveling In Media Player 9
    ... thought that volume leveling and "normalizing" are essentially the same thing. ... I have seen, through Windows Explorer, that files in a specific folder are ... modified when the files are played (by the modified date/time). ... I am importing tracks by Roxio's Easy Audio Capture through ...
    (microsoft.public.windowsmedia.player)
  • Re: How do I get my correct date sent/received headers back?
    ... How are you getting individual inboxes and sent items for individual accounts? ... folder, and into that account's Inbox, and the displayed sent/received ... corrupt to the date/time when the message was moved. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: e-mails from Sent folder display no date when moved
    ... You're right about the distinction between having the Sent Items folder ... showing the send date/time and the Deleted items folder showing the received ... Delete mail from Deleted Items older than 20 days. ...
    (microsoft.public.mac.office.entourage)