ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Back Up (https://www.excelbanter.com/excel-programming/306210-back-up.html)

Robin Clay[_3_]

Back Up
 
Greetings !

If, while using Windows Explorer,
I drag a folder from one disk to another,
the files in the dragged folder
and its sub-folders are written
to the target disk - regardless.

This means that
(a) newer files may be over-written by older files, and
(b) EVERY file is copied - which can take HOURS.


Challenge 1
I want to do selective backups,
copying from the "main" disk to
a backup disk ONLY those files
more recent than a defined date
(that of the last backup).

Challenge 2
I want to do a different form of
selective backup, copying from
the "main" disk to a backup disk
ONLY those files that either do
not exist on the backup disk,
or are more recent than the version
stored on the backup disk.


My current attempts are based
upon shelling out to DOS to run

dir /s Source.lst
dir /s Target.lst

to generate text files for the two disks.

The Target list is then read in
line-by-line and stored in a worksheet
with one file record on each line,
bearing in adjacent columns
the Drive letter, the path, the filename,
the date and the size.

I then read in the other file line-by-line
and compare this entry with the
tabulated entries. When a match is found,
action is directed into a batch file
that is run upon completion.

"There must be a better way" !

Any ideas would be most welcome !


RClay AT haswell DOT com


Bernie Deitrick

Back Up
 
Robin,

Are you interested only in Excel Files, or any file within the folder and
its sub-folders?

HTH,
Bernie
MS Excel MVP

"Robin Clay" wrote in message
...
Greetings !

If, while using Windows Explorer,
I drag a folder from one disk to another,
the files in the dragged folder
and its sub-folders are written
to the target disk - regardless.

This means that
(a) newer files may be over-written by older files, and
(b) EVERY file is copied - which can take HOURS.


Challenge 1
I want to do selective backups,
copying from the "main" disk to
a backup disk ONLY those files
more recent than a defined date
(that of the last backup).

Challenge 2
I want to do a different form of
selective backup, copying from
the "main" disk to a backup disk
ONLY those files that either do
not exist on the backup disk,
or are more recent than the version
stored on the backup disk.


My current attempts are based
upon shelling out to DOS to run

dir /s Source.lst
dir /s Target.lst

to generate text files for the two disks.

The Target list is then read in
line-by-line and stored in a worksheet
with one file record on each line,
bearing in adjacent columns
the Drive letter, the path, the filename,
the date and the size.

I then read in the other file line-by-line
and compare this entry with the
tabulated entries. When a match is found,
action is directed into a batch file
that is run upon completion.

"There must be a better way" !

Any ideas would be most welcome !


RClay AT haswell DOT com




Jeff Standen

Back Up
 
Yup - the FileSystemObject. Check out the Excel help for it. You can go
through each file in your drive/folder recursively and check the modified
date, copying it to the new location if it fits your criteria - that'll sort
option 1. You can also check to see if each file exists by looking for the
equivalent file on the target directory and copying the file if you get an
error message (ie the file doesn't exist). Add a reference to Microsoft
Scripting Runtime and declare a new FileSystemObject; that way you can see
all the properties and methods it supports - it's very versatile.

Jeff

"Robin Clay" wrote in message
...
Greetings !

If, while using Windows Explorer,
I drag a folder from one disk to another,
the files in the dragged folder
and its sub-folders are written
to the target disk - regardless.

This means that
(a) newer files may be over-written by older files, and
(b) EVERY file is copied - which can take HOURS.


Challenge 1
I want to do selective backups,
copying from the "main" disk to
a backup disk ONLY those files
more recent than a defined date
(that of the last backup).

Challenge 2
I want to do a different form of
selective backup, copying from
the "main" disk to a backup disk
ONLY those files that either do
not exist on the backup disk,
or are more recent than the version
stored on the backup disk.


My current attempts are based
upon shelling out to DOS to run

dir /s Source.lst
dir /s Target.lst

to generate text files for the two disks.

The Target list is then read in
line-by-line and stored in a worksheet
with one file record on each line,
bearing in adjacent columns
the Drive letter, the path, the filename,
the date and the size.

I then read in the other file line-by-line
and compare this entry with the
tabulated entries. When a match is found,
action is directed into a batch file
that is run upon completion.

"There must be a better way" !

Any ideas would be most welcome !


RClay AT haswell DOT com




Robin Clay[_3_]

Back Up
 

Everything !

Thanks for responding.

-----Original Message-----
Are you interested only in Excel Files, or any file

within the folder and
its sub-folders?

HTH,
Bernie
MS Excel MVP



RClay AT haswell DOT com



.


Robin Clay[_3_]

Back Up
 

Humphhhhh

This is the FOURTH time I have tried to reply to this !


-----Original Message-----
Yup - the FileSystemObject.
Check out the Excel help for it.


I did that - but hardly understood a word....
I am but a humble engineer.

You can go
through each file in your drive/folder
recursively and check the modified
date, copying it to the new location
if it fits your criteria - that'll sort
option 1. You can also check to see if
each file exists by looking for the
equivalent file on the target directory
and copying the file if you get an
error message (ie the file doesn't exist).


That sounds as if it's exactly what I want to achieve.

Add a reference to Microsoft
Scripting Runtime and declare a
new FileSystemObject; that way you can see
all the properties and methods it supports
- it's very versatile.


I wish I was ! I don't understand that bit at all :(

Thank you for responding - I guess I'm in for (yet
another) steep learning curve :(


RClay AT haswell DOT com



Robin Clay wrote


Greetings !

If, while using Windows Explorer,
I drag a folder from one disk to another,
the files in the dragged folder
and its sub-folders are written
to the target disk - regardless.

This means that
(a) newer files may be over-written by older files, and
(b) EVERY file is copied - which can take HOURS.


Challenge 1
I want to do selective backups,
copying from the "main" disk to
a backup disk ONLY those files
more recent than a defined date
(that of the last backup).

Challenge 2
I want to do a different form of
selective backup, copying from
the "main" disk to a backup disk
ONLY those files that either do
not exist on the backup disk,
or are more recent than the version
stored on the backup disk.


My current attempts are based
upon shelling out to DOS to run

dir /s Source.lst
dir /s Target.lst

to generate text files for the two disks.

The Target list is then read in
line-by-line and stored in a worksheet
with one file record on each line,
bearing in adjacent columns
the Drive letter, the path, the filename,
the date and the size.

I then read in the other file line-by-line
and compare this entry with the
tabulated entries. When a match is found,
action is directed into a batch file
that is run upon completion.

"There must be a better way" !

Any ideas would be most welcome !





All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com