Thursday, July 22, 2010

Bats and files

Recording here for future reference how to write a batch file to rename a bunch of XML files in Windows. Instructions by my husband, delivered in chat from his holiday, so big kudos to my lovely Heikki :)
  1. Export the file list to a csv file: dir /b *.xml > list.csv.
  2. Open list.csv in Excel.
  3. Copy the contents of column A to column B.
  4. Find and replace in column B as necessary (for me, replace - with _).
  5. Insert a column before A.
  6. Fill all cells of the new column A with the word ren.
  7. Select all and paste to Notepad. Each line should now read ren oldfilename newfilename. There is whitespace in between, this is normal.
  8. Save Notepad file as rename.bat. You now have a batch file.
  9. Run the batch file: enter rename.bat on the command line.
And voilĂ ! Your files are renamed.

(Yes, this is a big deal for me. Yeah, I'm not too knowledgeable about computery stuff. But I'm learning :)

Word to DITA

Simon Bate has a good tech tip for converting tables from Word to DITA. In sum: copy the table from Word to Excel, use columns to add tags, and copy back to a text editor.

Actually, Scriptorium's entire Tech Tips category is well worth reading :)

Wednesday, July 21, 2010

Windows command line

I'm just learning to use the command line in Windows, and just renamed a bunch of files in 5 minutes with the REN command rather than do it one by one in the GUI which would have taken at least half an hour and a lot of clickety click. Here is a list of command line commands in Windows XP.