Can you backup cached memory of an open file using Shadow Copy (VSS)? - batch-file

If I wanted to create a backup of a MS Word document that was open, I would need to close the file before any backup was possible. With Shadow Copy, I can backup an open file, but would the unsaved changes be backed up with the snapshot of the Word document?
I am trying to create a program that automatically creates backups of file(s) using Shadow Copy (VSS). I already have the Windows Task Scheduler setup but need the batch file for execution. However, I cannot seem to understand how to create such a batch file so that I can create a backup of an open file by Shadow Copying it onto another drive.
This is for personal/basic use. I cannot grasp at how to backup the unsaved information that would be "cached" in an open MS Word document. Is this even possible?
Thank you for your time.

Related

Cmd prompt for restoring files

I have a few power automate flows that rely on word documents that have been setup. However, my flow keeps breaking because with the company’s retention policy, the file is automatically deleted every few days. I have to go to the recycle bin to find the doc to restore and resubmit the flow.
I created a .bat file and linked to scheduler to run daily to check if the file is there, and if not to copy it to the folder from one of the permanent folders. However the flow still breaks because it doesn’t auto link the file again. It does link when I manually restore from deleted items. Can’t redirect the flow to permanent folder either. So easiest would be to update bat file to restore from recycle bin.
Currently it’s
IF NOT EXIST C:\users\’flow folder’ copy “g:\perm folder” “c:\flow folder”

Run batch file each time a specific file is saved

I have a shared Excel file on a network, and I want to create a backup each time the file is saved in case it gets overwritten or deleted by mistake.
I created a batch file to save a backup of the file with timestamp in the filename (found it here:https://datatofish.com/backup-file-timestamp/).
Now I'm looking for a way to trigger the batch file each time the file is saved so I will have a history of all the changes and backups in case of a problem. Is there a simple way to do that? Maybe using Task Scheduler? I've never used Task Scheduler so I would need a detailed description.
Thanks.

Copy Multiple DBF files content to other DBF files

I have 200 DBF files (related to Windows program) that I need to transfer their content to different DBF files that have the same names.. , i.e. file1.dbf content should be transferred to file1.dbf content from different folder, I need to do that for all 200 files. I can only find manual solution but its slow , I need to do it for all at once. The reason I need to do that is because the files have some protection or I don't get it, if I simply replace them the program will give error realated to db, other easier solution is welcome.
What really happened -
The files are used in accounting software. I have created the backup with backup function from the software, it was done daily automatically. Restore function is protected for free version. I can only manually restore the files, but the backup files work only on the exact software version as protection. The thing is that the software is 100% free as long as you don't update it, I didn't knew that until I selected the update menu option. Now the software is updated but it asks me for license key which is very expensive. I have the backup files, but as the restore function is blocked I can't restore it with the program. I can only replace the files myself from the backup , its a directory that is backed up. The problem is that it has some protection on files itself , they are not recognized but only if I manually edit the files with DBF Manager software, if I open a default software file and paste the content from backup file it works, but I have many files.Now I'm stuck with company documents locked not been able to access it
Thank you

Instructions set for backup and restore of SQL Server's DB (changing .mdf and .log file)

I have a series of repetitive tasks here at work. One of these is the creation of new database from a template.
To achieve this we have a *master_db* database that act like a template and its location is something like C:\Backup\master_db.bak.
After the creation of a new database new_db, right-click on it and go through Task->Restore->Database. In the General tab I choose From device and then I set C:\Backup\master_db.bak as restoring source. In the Options tab I'll choose Overwrite existing database and I also need to change .mdf and .log file (currently C:\SQLData\master_db.mdf and C:\SQLData\master_db_log.ldf in C:\SQLData\new_db.mdf and C:\SQLData\new_db_log.ldf).
This iter is in working order but for automation sake I need to do this step through code. What should I do? What parameters needs my RESTORE command? What command should I use to properly set .mdf and .ldf files?
restore database new_db from disk = 'C:\Backup\master_db.bak'
with
move '<data_file>' to 'C:\SQLData\new_db.mdf',
move '<log_file>' to 'C:\SQLData\new_db_log.ldf',
replace
You need to update <data_file> and <log_file> with the logical file names for these files. You should be able to see them in the GUI.

Android database backups

I'm looking for ways to back up the database of my app on an Android phone. I know that SQLite databases are just files, so I'd expect to be able to just copy the file to SD-card if one is available.
However, I'm unsure as to how I'd prepare my database/activity for backup/restore.
When starting, my main activity reads the entries from one table in the database and displays them in a ListView. As shown in the API's "Notes" sample, I have a cursor that is automatically notified about changes to that table (ListView is automatically updated when I add/remove/update records in the table).
So: When I copy the database file to SD-card, I should not have a problem. But what if the user wants to restore a database file? I can't just copy the file back to the data folder, can I (EDIT: ... while a view displays data from the database and thus maybe holds an open connection)?
What would be "best practice" when implementing backup/restore? One approach I've considered is:
Open a special "restore" activity
that holds no open database
connections
Call finish() for the
main activity to remove it and close
database connections
Copy back the database file
Open a new "instance" of the main activity
Call finish() for the "restore" activity
Would that be the way to go? Thanks for any advice!
But what if the user wants to restore a database file? I can't just copy the file back to the data folder, can I?
Yes, you can. As you can move the file from your data folder to a folder onto your SD card, you can move the file back from the SD card into your data folder.
What you proposed now, is a good approach, just keep in mind you do not want any open database objects during backup/restore.

Resources