Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have directory with *.wek files. Each day some application adds there about 10 new files. I want to archive only those 10 new files at certain time of the day. I've read about 7-zip mechanism but i haven't found how do i filter files for dates so only this day files will be archived.

Any help? thanks.

share|improve this question
    
do you want to put these 10 new files to a new archive or do you want to update an existing archive so at the end of the operation the existing archive contains 10 new files PLUS the old content? –  akira Aug 2 '10 at 8:13
    
@akira, i want to put new files in archive and delete previous set. ie. delete file.7z, add only new files –  eugeneK Aug 2 '10 at 8:24
add comment

1 Answer

I'm confused about what you're trying to do.

Option 1: Why not just zip the entire directory? The zip process doesn't care if there were 10 files yesterday, and 10 new ones that it added today.

Option 2: Create a batch file that deletes yesterday's zip file, then creates a new one for today.

Option 3: Create a batch file that archives the *.wek files one at a time. If the archived file already exists, don't do anything to that file.

Code for Option 3:

:: This file will backup *.wek files into *.wek.zip

:: i.e., abc.wek gets zipped into abc.wek.zip

:: If the matching zip file already exists, the original file does not get backed up.

:: i.e., if cde.wek.zip already exists, then cde.wek does not get backed up

:: IMPORTANT:

:: change \path\to\files (below) to the correct path to your files that need to be backed up

:: change \path\to\archives (below, twice) to the correct location of your backup folder

:: change c:\tools\7zip\7za.exe (below) to the correct path to the 7-zip command-line tool ::

:: make sure we're on the C drive

C:

:: change to our data directory

cd \path\to\files

:: create the backups

for %%k in (*.wek) do if not exist "c:\path\to\archives\%%k.zip" c:\tools\7zip\7za.exe a "c:\path\to\archives\%%k.zip" "%%k"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.