![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 4
![]() |
Time modified
Hey i'm trying to write a backup program for a project for school. One of the things i have to do is create a constructor with three arguments: src (file being save) dest (location to save it to) and long time (milliseconds) that indicates when the last backup was. How would i go about using the time arguement within my code? I was thinking when the file is created give it a time in milliseconds and then overwrite it when the file is backuped again? Any suggestions???
|
|
|
|
|
|
#2 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 769
Rep Power: 3
![]() |
You might be able to do something with the File.lastModified() method. If you're backing up to the same file every time, you could compare that to the current file. If you back up to different places you might have to keep track of things accordingly.
|
|
|
|
|
|
#3 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 4
![]() |
it's not the same file it's a directory of files that need to go from one directory to another. I found this:
getBackupFile public java.io.File getBackupFile() Get the name of the backup file for this resource. through google but i'm not sure how to use it within my code. |
|
|
|
|
|
#4 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 769
Rep Power: 3
![]() |
Sounds like something someone wrote for themselves. You could write your own, and keep some sort of record of what's backed up to where. And if you're dealing with directories, you could to use File.listFiles(), and then check files in each directory. It's a little hard for me to give advice as to how to do it, as I don't totally know how your program works...
|
|
|
|
|
|
#5 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 4
![]() |
It's for a class final project:
Create a class named Archiver with a consturctor like so: Archiver(src, dest, long time) //where src is the source file and dest is the destination file i also need to have a method "getChangedFiles" which returns a list of files needed to be backed up (ones that have been modified since the last backup) another method called "backup" which actually does the backup then i need another class named "ArchiveDriver" which maintains a txt file that reads multiple lines of text that look like: C:\src C:\dest 1234567 which becomes the arugement of Archiver's constructor lastly the user should be able to backup, restore, and compress the files backed up. So as you can see this is quiet a complex and challenging project which i'm really stuck on... lol |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|