Monday, November 9, 2009

How to backup data to DVD and find them later with ease

"Which DVD did I backup my file to?" I have certainly, for many times in the past, stared at a pile of CD/DVDs, scratched my head and for the life of me couldn't figure out where a particular file went.

Eventually I found a simple solution that works for me. Basically, every time I burn a DVD, I'd use a Python script to create a text file with the same name as the DVD label, and this file will record all the file names/directories on that DVD.

I put all these files in a folder, and this is what it looks like:



Every time I need to find a file, I would select a bunch text files, and open them all in Notepad++



In Notepad++, I would go to: "Search > Find" (or press: Ctrl + F), type in the file name, click "Find All in All Opened Documents", and voila! In seconds I could find out which DVD has the file I wanted.



Step-by-step guide:

Required downloads:
1. download and install python (current version 2.6.4, ~14mb)
2. download and install notepad++ (my favourite text editor, ~3.4 mb), or any other text editor that allows you to search for keywords in multiple files.
3. download and save the python script to your hard drive:
backup_solution.py

Create content text files for DVDs:

1. create a folder in your hard drive to store backup information. (I'll use C:/mybackup as the example directory from now on)

2. put the python script "backup_solution.py" into the folder created in 1.

3. Open backup_solution.py with a text editor, scroll down to the bottom of the file, go to line #66:
# Edit the following 2 lines
xpath = "G:/"
output = "content.txt"

4. change xpath to the path of your DVD drive (mine is "G:/"). eg. If your DVD drive is D, change the line to:
xpath = "D:/"

5. save and close backup_solution.py

6. burn your files to DVD as usual.

7. When the DVD burning is done, don't remove it from the drive just yet. With the DVD in the drive, double-click backup_solution.py, the script will now search your DVD and write all the file and folder names into a file called content.txt and place it in C:/mybackup.

8.1 change the name of content.txt to be the same as the label of your DVD. I will often name my DVD using the date + a short description. eg. "2009_10_19_videos.txt", "2009_11_9_photos.txt".

8.2 Alternatively, you can change the following line in backup_solution.py before running step 5:
output = "2009_11_9_photos.txt"

A Handy Tip:
When viewing the text files generated by the script in Notepad++, you can go to: top panel > language > python; then go to: View > Fold All (or press Alt + 0). Now you can click the [+] or [-] sign next to the paths to expand/collapse the file lists.



Final Note:

If you know Python, feel free to customize the script to create more advanced outputs.

No comments:

Post a Comment