batch file to copy files from last month to archive it.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Samsunlu

Thread Starter
Joined
Apr 12, 2010
Messages
4
Hi all,

I need a batch file (code) to copy files from last month and zip it for archive. Can somebody help me please?

Thanks!
Samsunlu
 

Squashman

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
Are these files all sitting on one folder or are they spread out across a nested directory structure?
What cmd line zip program are you using?
 

Samsunlu

Thread Starter
Joined
Apr 12, 2010
Messages
4
Hi Squashman,

Thanks for responding so quick!

These are files in different folders. And I'm using 7z to zip the files.
 

Squashman

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
Are they in a BASE folder and nested from there or are we going to have to search the whole hard drive?
Are we working off of created or modified date?
 

Samsunlu

Thread Starter
Joined
Apr 12, 2010
Messages
4
We don't need to search the whole hard drive.

What I need is:

Everyday we create files and process them. After the processing I have to archive the files.
They are not in one folder but in 2 folders with a couple sub folders on one server.

Before I manually copied the files into an other server and zipped them manually on a monthly base (sorted by created date).
But this takes much time for me so I'm working on / looking for a script to automate this process.

I hope you understand my question?
My English is not perfect (I'm Dutch...)

Thanks!
 

Squashman

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
So you have something like this. Basically two base folders with nested subfolders.
Code:
C:.
├───Folder1
│   │   file1.txt
│   │   file2.txt
│   │   
│   ├───Subfolder1
│   │       File3.txt
│   │       file4.txt
│   │
├───Folder2
│       foo1.txt
│       foo2.txt│
Where is the archive going to be placed? I would assume outside of this folder structure otherwise you may end up archiving the archive.

I would assume this would run the first of the month. So when May 1st comes around you will want it to archive all files that were created in April in the two base folders. What do you want to do with the files after they are archived? Do you want them deleted from the two base folders? If you remove all the files from a nested folder do you want the folder removed as well?
 

Samsunlu

Thread Starter
Joined
Apr 12, 2010
Messages
4
Thanks Squashman, this is exactly my situation.

In C:\Folder1\Done I have a couple of subfolders (C:\Folder1\export, C:\Folder1\Import etc).
In C:\Folder2 I also have subfolders and al lot files to be archived.

I want the archiving process to start the first of the month indeed. Your example is correct (start the archive process on May 1st, all files created in April should be archived).

And I want the files to be zipped after archiving to an other location (server).

The original files in C:\Folder1 and Folder2 can be deleted.

Thanks!!
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top