Robin Kemp's blog

Using symbolic links in Vista to fix iTunes library

Today I had a user call about a problem with iTunes not finding any music after migrating to Vista.  The problem was that they'd not kept all their music in the "iTunes Music" directory and it was spread out all over the "My Documents" directory on the old machine, and the username was also different so the default link that Vista creates (from "Documents and Settings" to "Users") wouldn't work. So instead of recreating the iTunes library from scratch or relocating all the files I remembered that Vista now supports symbolic links, so all that was needed was to create a directory in users with the old username then use MKLINK to create a link from the old location (C:\Documents and Settings\oldusername\My Documents) to the new one (C:\Users\newusername\Documents) and all was well.  

Using MKLINK is fairly easy, but you need to run the command prompt as administrator in order to do it.  To create a symbolic link to a directory you use the /D switch like so :

mklink /d "c:\Documents and Settings\bob\my documents" "c:\users\Robin\Documents" 

Which will link them so when you try to access the old location, it will look in the new path.   Also you can remove a link by removing the directory, if you're unsure then DIR will show you if the directory is a real directory or a symbolic link. 

Website backup script

The attached zip contains a very simple script that uses WinSCP , FI and 7-Zip to backup a website via FTP to the local machine.  It first downloads the entire site to the directory it was run from, 7-Zips it to the output directory, deletes the temporary copy and then checks the output directory for backups older than 30 days and deletes them.

To configure it for your own use you will need to edit the winscpscript.txt and change the following lines to your FTP details and the directory you want to back up if public_html isn't where your website is stored.

open ftp://username:password@ftp.sitename.com
get public_html/* website-backup\*'                 

The default output is C:\WebsiteBackup but if you need to change it you can edit the websitebackup.bat and change 'c:\WebsiteBackup' in the following lines:

7za a c:\WebsiteBackup\backup-%dtt%.7z website-backup
For /f "Tokens=*" %%f in ('fi /A-d /b /gw">"30 C:\WebsiteBackup\*.*') do del /q               

Google

blog categories