Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Hey, Scripting Guy! How Can I Use a File Mask When Renaming Files?

(image) Hey, Scripting Guy! How can I change file names using a file mask? You know, like when you run the command-line command ren ??x???p?.* ?a????bc.x??.-- AM (image) (image) (image) Hey, AM. Well, the big news out of Seattle is that the Mariners have fired their general manager, Bill Bavasi; that’s to be expected when you spend $...

Hey, Scripting Guy! How Can I Move Files Based on Their Three-Part File Name?

(image) Hey, Scripting Guy! I have a folder filled with invoice files. Each of these files has been given a file name based on a specific three-part naming convention: a three-letter abbreviation of the vendor name; the invoice date (e.g., 06032008) ; and the invoice number (which can be of varying length). In other words, all the files have...

Hey, Scripting Guy! How Can I Delete All the Files in a Folder Except for the Most-Recently Created File?

(image) Hey, Scripting Guy! I have a folder that has about 50 files in it. How can I delete all those files except the one most-recently created?-- GA(image) (image) (image) Hey, GA. You know, today would be a good day to review some of the items that have recently been in the news. (You know that life must be exceedingly dull for the ...

Hey, Scripting Guy! How Can I Use Windows PowerShell to Pick Out the Unique File Extensions Used in a Collection of Files?

(image) Hey, Scripting Guy! I’m having a strange problem with Windows PowerShell, and I was wondering if you could help me solve it. I’m trying to get a list of the unique file extensions used by the files in a folder. I have a whole bunch of different file types in that folder, but every time I run my command it returns just one file ...

Hey, Scripting Guy! How Can I Identify the 20 Most-Recently Modified Files in a Folder?

(image) Hey, Scripting Guy! I Using VBScript, how can I identify the 20 most-recently modified files in a folder?-- TW(image) (image) (image) Hey, TW. You know, the Scripting Guy who writes this column was just reading – thanks to the magic of Spam email – about a new voice mail service. With this service you don’t have to listen to ...