Posts tagged ‘VBScript’

A Windows Shell Script To Automatically Rename And Move Images To A New Folder

Recently asked on Yahoo! Answers:

How do I set Windows XP to rename same named files when in same directory?
I’m putting thousands of images and other files in the same folder so that I can sort from that folder, I want to keep all the versions that I may have the same file name with different names when I put them in that folder. If I can I would also like to leave the () out of the new rename. I’ve seen other computers that do the renaming automatically, this would save me time from the current setting in which it asks with each file if I want to overwrite it and if it doesn’t overwrite it just leaves the file where it was before without putting it in!

This is simple enough to do if you have a little knowledge of VBScript; in this case, as it pertains to the Windows Scripting Host (or whatever Microsoft calls it these days).

Basically, a few lines of VBS can quickly get all the files in a directory, maintain their current sort order, rename them to be 100 percent unique, and move those files from whatever directory they are currently in to wherever we want them to go.

Let’s do it. As always, code you can download appears at the end of this listing.

Continue reading ‘A Windows Shell Script To Automatically Rename And Move Images To A New Folder’ »

Using VBScript To Automate eBay Turbo Listing HTML Page Editing

Recently asked on Yahoo! Answers:

Help with VB script?

I am new to all this, so please forgive me for talking like a newbie.

I am trying to get into the wonderful world of vbscript to try to help me speed up my listings on Ebay.
[details snipped]

Now as you would imagine all the above takes me several hours to do, and I just thought if I could get my head around a little bit of vbscripting I would save myself one hell of a lot of time. If any kind person out there could point me in the right direction it would be much appreciated.

To summarize what this questioner wants done:

  • He takes about 300 images per night with his digital camera; it somehow orders the photos.
  • He wants to create however many directories are needed to put five photos each into each new directory; each directory should be sequentially numbered based on the last directory he created.
  • He wants to create copies of an HTML template, name it the same as each of the new directories, and change some text in the template to be the same as each folders’ number.

Well, that’s fairly easy to do with VBScript, as he suggests — and it takes VBScript all of about two seconds to do the work.

Since it’s been a cow’s age since I’ve used VBScript to automate something like this, I knew I had to put this script together. It demonstrates some really cool things you can do with shell scripting:

  • Create directories on-the-fly;
  • Move files from one directory to another;
  • Rename files to something else, based on patterns or numeric values;
  • Edit text-based files.

As always, I’ll have the code and sample files available as a download at the end of this post.

Continue reading ‘Using VBScript To Automate eBay Turbo Listing HTML Page Editing’ »