Fully Automated Image Processing for eBay

eBay LogoWhen I list items for sale on eBay, I use a custom-developed HTML template with the item’s pictures uploaded externally and embedded into the description for more visual appeal than what eBay provides. This allows me to apply custom styles to the images via CSS, provide descriptive content below specific images and generally offers a lot more flexibility and professionalism.

By default, eBay allows you to upload up to 12 images for free to be included in the ad, and requires uploading at least one image through their service to be displayed in the auction results and so forth. The images uploaded in this manner appear at the very top of the auction page alongside the auction metadata. These eBay-hosted pictures are scaled to 500x375px regardless of the user’s screen resolution, with an option to view larger versions by clicking/hovering over them.

eBay Example Ad

An example eBay ad depicting the fixed image resolution and placement using the default eBay image hosting.

This layout is convenient for when users first visit an auction or when there is not a lot of descriptive content needed, as all the information the user needs is right up at the top without needing to scroll. The functionality of the image slideshow and enlarging has also improved substantially over the years from when eBay first started offering free image hosting.  I want to also emphasize, before describing my automated method of image processing and hosting, that it is still essential to use eBay’s own image hosting service alongside your own (for up to 12 images) so that you can still embrace their free top-of-the-page slideshow.

The Tedious Process of Manually Hosting Pictures

There are usually a lot of steps involved in taking photographs and ultimately embedding them into your eBay auction description. In my case, managing images (with or without using eBay’s own service) proved to be the most time-consuming process of listing an item. The basic process of capturing, transferring, optimizing and re-saving images can itself consume a lot of time. The general method many people use for manual image preparation and hosting is as follows:

  1. Take the photographs of the item you wish to list on a digital camera.
  2. Transfer the pictures to your computer using a card reader, direct connect or via WiFi on supported cameras.
  3. Open the images in a photo editor and resize them to reduce file size and load time.
  4. Enhance each image by adjusting brightness, levels etc.
  5. Re-save the optimized images, renaming them as needed.
  6. Connect to an FTP server or file host via a third party application.
  7. Upload all of the auction item pictures to the remote server.
  8. Add custom HTML tags for each image within your auction description, specifying the full URL and image names accordingly.

Writing an Automated Script to Do It All

I hate needless repetition and boring tasks. With that in mind, I set out to create a completely automated system of transferring, resizing, enhancing, saving, uploading and embedding images into a custom HTML document. Essentially, I wanted to be able to perform steps #2 through #8 above with a single click after inserting my camera’s memory card into my computer. The end result is a batch file that does exactly that!

Baseline Script Requirements

To successfully use my automated script provided below, a few basic requirements need to be in place.

  • You must have a memory card reader for transferring your camera’s photos (direct connect would also work, but WiFi will not).
  • You must have an external FTP server/host available for transferring the images to (e.g., ftp.example.com) and know the login credentials.
  • You must know the location on the FTP server where your eBay images should be uploaded to, and that directory must be created. (e.g., /ebay/)
  • You must know the absolute URL of where the images are accessible once uploaded (e.g., http://example.com/ebay/)
  • You must have the ImageMagick command-line tools installed and available to the system (see below).
  • You should transfer the photos via this script on a per-item basis (i.e., after taking a set of photos for one specific item).

Using ImageMagick for Image Enhancements and Optimization

ImageMagickTo apply image enhancements and resizing as part of the automated process, I embrace the free, cross-platform library ImageMagick. This set of tools enables you to perform any number of programmatic operations on as many images as needed from a command-line interface, in a very efficient manner. To install the necessary components, head on over to the Binary Releases page of the ImageMagick website and review the instructions for your particular platform.

Note that I wrote my script to run on Windows as a standard batch file, so if you are using another operating system you will have to revise the script accordingly using commands available to that platform. For Windows, there are a number of ImageMagick binary packages available. You will want to get the one that matches your machine’s architecture (32-bit or 64-bit); the static variant works fine for this process. In this example, I downloaded the ImageMagick-6.9.3-5-Q16-x64-static.exe installer and ran it. I changed the install path to C:\ImageMagick\ as a personal preference so that it is a short path with no spaces and within a writable location.

Important: To verify that ImageMagick has been installed and mapped correctly on your machine, open a command prompt / terminal and enter:

You should then see a few lines of information about the currently installed version of ImageMagick—this means it is ready to roll! If you attempt to run this command in a write-protected directory, you may instead get the message “Invalid drive specification.” Don’t fret, this still indicates that the ImageMagick library is installed successfully.

If you instead get the message that “‘convert’ is not recognized as an internal or external command” when running the above command, you will need to add the base path (i.e., c:\imagemagick\) to your environmental path.

Finally, the Script!

With all that headway taken care of, all that remains is to present my batch file script. You will want to copy the contents below into a new text file, and save it as “Images.bat” or whatever you prefer. The batch file should be placed in the base directory where you wish to store all eBay photos on your computer (i.e., C:\ebay\). Make sure, when saving, to wrap the name in quotes to ensure that the extension is not overwritten (especially important if using Notepad).

As a convenience, the script below can also be downloaded as a batch file here: Images.bat

Important: See below the script for initial setup details.

Initial Script Setup

The script is well-commented and generally self-explanatory. Under the “Initialization and Variable Declaration” section, you will need to update the following:

  • FTP Details: Your FTP host, username, password, and directory to navigate to once connected before uploading images (the directory must already exist). Note that since this is stored in plaintext, you may wish to create a custom FTP account through your host and restrict its access to the ebay pictures folder, and use those account credentials here.
  • Remote URL: The absolute URL that the images will be accessible at. (i.e., http://www.example.com/ebay/)
  • Memory Card: The full system path to your memory card’s photo location (i.e., E:\DCIM\123D4567\)
  • Image Prefix: The first few letters or numbers that your camera prepends to each image (i.e., DSC).
  • Image Width: The width, in pixels, that the image should be resized to. This depends on your HTML template but should never exceed 1390px as that is the maximum available space eBay provides for the description content (1460px body – 70px padding).

When you launch the batch file, you will be prompted for a Base Photo Name. This should reference the item in a few unique letters to ensure no conflicts arise when uploading to the server (i.e., alarmclock). The script will then name the images accordingly (i.e.,  alarmclock-1.jpg, alarmclock-2.jpg).

After entering the base photo name, hit ENTER and the rest should be automated! At the end, the HTML image tag code will already be copied to your clipboard and ready for insertion into your favorite HTML template or directly into the eBay description field.

Script Notes and Information

  • Delayed expansion is disabled and enabled a couple times in the script to best handle different types of variables and operations.
  • A temporary JavaScript file is created to generate a YYYYMMDD string of the current date, for the folder naming, and is then deleted.
  • The images are temporarily renamed to *.tmp during processing to prevent conflicts with previously stored images in the same directory; if you are using the script to process multiple photo sets on a single day, this ensures no file overwriting or redundant processing.
  • The ImageMagick tool Mogrify is used to enhance and optimize the images. I apply the “normalize” filter to improve visual contrast and brightness, but you can experiment with others such as “auto-levels” for differing effects.
  • A temporary text file is created in the current picture directory named html.txt that stores the generated HTML image tags with the uploaded image paths. This data is copied to your clipboard automatically by the script, but the file is preserved so that it can be accessed in the event that you copy something else to your clipboard before pasting the data. You can uncomment line 133 (del html.txt 2>NUL) if you’d wish for this file to be deleted automatically.
  • The FTP functionality creates a temporary secondary batch file for queuing the FTP login, navigation and uploading commands. This file is deleted automatically on finish.

Making the Images Responsive and Getting Creative

The script presented above generates the bare-minimum HTML required for inserting full-sized images into your custom HTML template. As-is, this method will display the images at their original dimensions (as defined via the imagewidth declaration and up to 1390px wide on eBay) regardless of the user’s screen resolution or platform. This means that on mobile devices–where the user may only have a 320px wide viewport–the page contents in their entirety will be shrunk down on most browsers, resulting in the microscopic text effect seen often on non-mobile optimized sites and forcing the user to zoom-in and scroll horizontally.

There are a few simple ways to remedy this issue. One could hard-code width="100%" height="auto" attributes into each image tag (by modifying the script above slightly), thus ensuring that the images will stretch to the maximum space allocated by its parent container. However, this adds unnecessarily to the body content and also provides quite limited customization. My personal recommendation is to instead embed the generated image HTML code inside of a custom parent container, and then add styles to your template that set the parent image container attributes along with the images themselves, as follows:

Insert the generated image HTML tags into a custom image container element:

At the top of your template code, add styles for the image container and item images.

The .imgContainer styles ensure that it will not exceed 100% width and also put in basic center alignment properties so the images will appear centered on-screen. The .imgContainer img styles specify a 100% width and auto height so the images will scale to full-width while retaining their original aspect ratio. I also add some general styling to give the images soft corners, a shaded border and other basic attributes. If you do not want to scale-up any images beyond their original size, change the width parameter to max-width.

With this modified code, assuming your overall template container (either a TABLE or another DIV) also has a width property of 100%, the images will then scale appropriately depending on the user’s resolution.

2016/03/20 Edit: Added a blurb about converting the generated images into a responsive format to ensure proper rendering on mobile devices.

Windows XP Drivers for NVIDIA Geforce GTX 970, 980, 980 TI and Titan X, say what?!

Windows XPI recently built a new computer to better accommodate the forthcoming line of resource-intensive tech products, namely the Oculus Rift and related VR devices. While my old computer was nothing to shake a stick at, its hardware was not satisfactory enough to produce a consistently smooth experience on the Developer Kit 2 (DK2). The second iteration of the developer headset kit requires rendering a 1920×1080 display (960×1080 per eye) 75 times per second or else latency and lag lead to a jittery and nauseating experience. When the consumer version drops next year the hardware demands will be even greater.

With my latest PC upgrade (Geforce GTX 980 TI, MSI Z97 Gaming 5 motherboard with an Intel i7 4790k CPU, 32GB RAM, Samsung SSD 840 Pro, Sound Blaster Zx) I made the sudden, albeit fully expected observation—none of these new components provided any Windows XP support by the manufacturers. After all, Microsoft itself ceased mainstream support for XP way back in 2009 and officially declared it to be ‘end of life’ and fully unsupported in April 2014.  It makes zero sense for any manufacturers to waste additional developer resources maintaining support for such an archaic and unsupported operating system, even as millions of diehards still cling on.

Holding On to Windows XP

Confession time. From the moment I upgraded to Windows Vista many years ago (and abruptly to Windows 7, then 8, now 10) I have always maintained a separate partition or dedicated hard drive with Windows XP 32-bit installed as a multi-boot system. Why? For an absurdly limited number of reasons, if I’m honest. It is a lot more convenient and often perfectly adequate to simply create a virtual machine (i.e., using Virtual Box or Hyper-V) for Windows XP as a guest OS. One of the key reasons for using XP these days is for niche software that may not run appropriately or at all on more recent operating systems, even when in compatibility mode.

But, even as revolutionary as OS emulation has become with the advent of hardware virtualization, it still doesn’t compare to a bare metal native OS install. This is especially true when running games that may utilize OpenGL or DirectX, 3D applications and other computer-intensive processes. This typically comes down to GPU restrictions, although even that sector of virtualization is making strides with innovations like NVidia Grid. In my case specifically, I keep Windows XP 32-bit on-hand for a select handful of very obscure and specific applications, including some games and programs developed with older technologies and frameworks from the 1990s.

Jetmen Revival

Jetmen Revival: One example of a Windows XP game that does not work properly in later versions of Windows or virtual machines, regardless of compatibility mode settings.

Exhibit A: There is an old indie game known as Jetmen Revival, developed by Crew42 in the early 2000s (I believe using a Delphi 5 library). I enjoyed this game endlessly over the years, and even had a stab at redeveloping it myself for modern hardware but never found the opportunity to complete it. On non-XP machines, depending on the video card and driver software, the game will either crash upon launch, glitch out upon play, or chug along sluggishly creating an equally unplayable experience. No matter what compatibility settings and hardware adjustments are made, this game simply will not run as it was intended on modern machines nor in virtual machines.

Installing Geforce GTX 980 TI (970/980/Titan X) On Windows XP

Naturally, none of the latest video cards by NVIDIA or AMD officially support Windows XP. If you perform a Windows XP driver search on the respective manufacturer websites for any later cards such as the Geforce 970+ or AMD R7 3xx+ you’ll find no results. However, where there’s a will there’s a way.

Here’s the basic process of how to get the Geforce GTX 980 TI to cooperate with Windows XP. The same process can be used if you have a GTX 970, 980, Titan X or other unsupported cards.

  1. Download the latest and greatest Windows XP driver available from NVIDIA’s official website. As it turns out, the last video card that NVIDIA still offers active XP drivers for is the GTX 960. As such, modifying them to accommodate subsequent 900-series cards is pretty effortless since the cards all share the same driver base. This should also work for other cards that NVIDIA may not directly support such as the GTX 690. Make sure you select the correct driver architecture for the XP driver, 32-bit or 64-bit based on your specific install. I personally prefer Windows XP 32-bit as it holds the greatest compatibility with apps and can be less of a pain to get up and running with the Geforce drivers, but if you do need more than ~3.5GB of usable RAM or want to squeeze the very most out of your 64-bit CPU then Windows XP 64-bit would be the better option. At the time of this writing, version 359.06 was available from December 1, 2015 but future ones will work equally well.

    GTX 960 Official Drivers

    GTX 960 Official Drivers

  2. Once the file has been downloaded, launch it. Specify an extraction path and copy this path to your clipboard or otherwise note it for future reference. By default it will extract the driver files to: C:\NVIDIA\DisplayDriver\359.06\WinXP\International Click OK and wait for the files to extract. Close the installer when it appears.
  3. Navigate to the extracted directory from the previous step. Once there, go into the Display.Driver directory and open up the file nv4_dispi.inf in your favorite plain text editor (Notepad will suffice).
  4. There are two areas of interest in this .inf file that you’ll need to modify. First, the section [NVIDIA_Devices.NTx86.5.1] includes the hardware identifiers for all of NVIDIA’s supported cards under Windows XP. (If you are using the 64-bit version of XP you’ll instead want to find [NVIDIA_Devices.NTamd64.5.1] [NVIDIA_Devices.NTamd64.5.2] {corrected per comment from filippo}). Anywhere in this section, add the following hardware IDs.

    This corresponds to the device IDs of NVIDIA’s entire top tier line of non-XP supported cards including the GTX 970, GTX 980, GTX 980 TI, GTX Titan X and Quadro M6000. By adding these identifiers, we can fake the driver installer into believing the installed GPU is supported by XP; since the underlying drivers are not any different it will be just fine! The Section### clause in the lines above corresponds to what settings and components will be installed for these particular cards; in the case of the 900 series it matches the same category referenced by the GTX 960. However, different drivers and versions may alter this section number (i.e., the Windows 10 drivers use Section044 for the 900 series). So if you get a ‘Failed’ message upon trying to install the driver, you may have to double check this section number.

    Note: If you are attempting this in the future or on a card not referenced above, the easiest way to find the proper identifier is to first note the device hardware ID of the graphics card from within the Device Manager. The device ID will be listed similar to “PCI\VEN_10DE&DEV_17C8&4CC_0300” Note the four characters after DEV_. Next, download the latest Windows 7/10 driver from NVIDIA’s site, extract it (steps 2-3 above), and open the nv_dispi.inf file. Do a search for the four digit code and copy the found lines to the corresponding Windows XP nv4_dispi.inf file.

  5. The second part of the nv4_dispi.inf file that needs editing is found at the bottom under [Strings]. Go to this section and add the following:

    Notice that all of the DEV.#### references above correspond to the entries we added in step 4 and reflect the hardware device IDs for the previously unsupported cards.

  6. Re-save this file under the same nv4_dispi.inf name (select ‘Yes‘ to overwrite, if prompted).

Breathe. If you followed the steps above, you should now be able to run the setup.exe file in the parent directory that the original package was extracted to in step #2 above without it failing.

NVIDIA Driver Setup

The NVIDIA driver setup wizard using the custom install process, running Windows XP and a GTX 980 TI.

During the setup process, you will receive at least one driver signing alert. Press the Continue Anyway button to proceed.

If you attempted to run the setup wizard previously, you would receive an alert that no compatible card was found on your system. However, now that we added the missing product identifiers, the setup continues without error. Either choose Express or Custom setup and finish it up. I recommend specifying Custom and checking the option to Perform a Clean Installation just to ensure all bits of default video drivers are cleared up and not conflicting. (Instead of running the setup wizard, you could had optionally installed the driver directly from within the Device Manager, but would then be missing NVIDIA’s control panel and other core packages essential to its operations).

NVIDIA Driver Setup

Success! The full suite of NVIDIA driver software has been installed on Windows XP 32-bit for a GTX 980 TI.

Restart your computer after the install is complete and you should be ready to rock like it’s 2001 all over again, except with a super pumped up machine!

Windows XP on Modern Hardware: Other Considerations

There is obviously a lot more to work out when pitting modern hardware against Windows XP than just video drivers. Just getting the two operating systems to dual boot nicely can prove challenging. The easiest route is typically to install Windows XP first and then install Windows 10 to a new partition or separate connected drive afterward. This will allow Windows to create a suitable bootloader automatically to switch between them (I recommend also running ” bcdedit /set {default} bootmenupolicy legacy” from an elevated command prompt in Windows 10 to restore the original black bootloader screen and F8 boot functionality).

If your Windows 10 install is done via UEFI you could run into more complications and will generally need to alter your BIOS to disable secure boot and enable legacy boot mode alongside UEFI. I’ve done it both ways successfully, installing XP both before and after Windows 10, but when installing it afterward there are more headaches trying to get appropriate bootloader functionality and you’ll sometimes wind up unable to boot at all!

Modern motherboards will also not include any chipset drivers for XP on their own website. Thankfully, a lot of motherboard components are actually from third parties (i.e., Realtek HD / AC97 audio) so you can look up the device hardware IDs and seek out XP drivers that way. It becomes a trade-off of how much time are you willing to spend chasing chipset drivers down or modifying existing drivers to work; if the system is functioning well enough for you to do everything you need then you probably don’t need to worry about installing specific chipset drivers for the legacy XP install. For audio, if you cannot find drivers for your particular sound card and are not using on-board sound, consider purchasing simple USB-powered desktop speakers to alleviate the need of hacking together your own drivers for a modern sound card. Another option would be to embrace the HDMI/DisplayPort audio out if your display supports sound; the driver will be installed during the NVIDIA driver installation.

Who would had thought I’d be spending this much time writing about Windows XP near the dawn of 2016? 🙂

SAMSUNG Remote Test Lab: Test Android Apps on Real Devices for Free

ScribblifyFor the past couple of months, I’ve been working on a much-delayed update to my Android application Scribblify.  The original Android version was released back in early 2013 and hadn’t been updated on Google Play since then. Although it paled in comparison to the iOS counterpart, the first Android version still received positive reviews and was downloaded 200,000 times. Having released a major 4.0 update to the iOS version earlier this year, it was time to bring the Android version up-to-speed.

One of the greater challenges experienced with Android development occurs when it comes time to test. I previously wrote about the increasingly fragmented iOS platform, but even with a handful of different iOS devices sporting different resolutions and technical specs, nothing quite compares to Android device dispersion. In my updated Android app, for instance, I support all Android devices from API Level 15 (Android 4.0.3) up. According to Google Play, this makes the app compatible with 9,098 Google-certified devices. This list encompasses at least four years of devices including phones, tablets, phablets and more. Understandably, with such a large range of devices comes an equally large range of technical specs.

So, when it comes time to test an Android app, the more devices available to experiment with the merrier. It is particularly worth testing against the multitude of different device resolutions and DPI specifications to ensure that all assets scale appropriately, as well as testing against various OS versions to ensure nothing breaks. Google provides the Android Virtual Device (AVD) Manager, available through Eclipse, Android Studio and as a standalone tool. AVD Manager allows you to create custom-tailored virtual devices spanning the entire core spectrum of Android units, provided you’ve installed the necessary packages via SDK Manager.  However, Android emulation via AVD is traditionally sluggish and will not always behave as expected. There are also more dedicated and responsive Android emulators for testing including Bluestacks, which I wrote a tutorial about previously (other popular Android emulators include Andy, Xamarin, and YouWave).

Testing on Physical Devices using SAMSUNG Remote Test Lab

Android DevelopmentFor more assured Android app testing than software emulation can reasonably provide, it is always favorable to test on physical devices where available. Basic Google-certified tablets with the latest Android OS can now be purchased for as little as $30-$75 at many retailers and work wonderfully for testing.  Even some of the more high-end phones and tablets can be affordable when bought used online at sites like eBay. As long as the device is Google-certified and supports Google Play, it is ripe for app testing.

Still, there is another avenue for development testing against an assortment of popular and new Android-powered products–without having to deplete your life’s savings while amassing a mountain of test devices. Cloud-based device testing is a growing way to test your app on physical Android units around the world. Popular players in this field include Keynote by Dynatrace, Sauce Labs and Remote TestKit. These and other related services are generally subscription-based but offer free trial periods.

Sometimes though, as the saying goes, the best things in life are free. One free cloud-based testing service that I’ve grown to love is the SAMSUNG Remote Test Lab. This completely free service, provided by SAMSUNG, allows you to interface with a couple dozen different phones and tablets of diverse specifications.

Getting Started

To get started, you will need to register a free account in the SAMSUNG Developer Portal. After registering and verifying your email address, you can make your way over to the Remote Test Lab landing page. The testing application has a few minimal technical requirements including JavaScript, Java Web Start and a browser from this decade. If any of the configuration is missing the page will alert you.

SAMSUNG Remote Test Lab

The SAMSUNG Remote Test Lab offers free app testing on a couple dozen Android devices.

From this page, you can browse through the various devices or narrow down the results by category using the tabs across the top.  Most of the test devices are available in multiple different OS versions,making them ideal for testing against OS changes that may affect particular features of an app. The range is substantial, from the now archaic 2.3.3 through 5.1.1 at the time of this writing. When you have arrived at an attractive device that you wish to test against, select the appropriate parameters from the drop-down lists (OS Version, Device List [Location], Reserve Time).

The free testing system works using Credits. Every day that you login to the SAMSUNG developer portal, you will receive 20 additional credits towards testing. These credits accrue so if you sign-in three different days you will accumulate 60 credits. Each credit is good for 15 minutes of physical device testing, and you have to commit to 30 minute minimum sessions (you can also cancel device reservations early to receive unused credits back). In any case you are not likely to run out of testing time too quickly, considering each day of logging in buys you another five hours of testing time.

When you are ready to launch the test device, just hit the Start button.

Running the Hardware Simulator

After starting a device simulator from the SAMSUNG Test Lab, a Java applet will launch. Depending on your browser and OS configuration, you may be prompted a couple of times to open and run the script (say Open / Yes / Run where appropriate). If you are currently not signed in you will still be able to do a 5-minute Pre-Test, which is a good idea to ensure the selected device is functional and usable on the simulator.

When the device first launches, hit OK after reviewing the terms and then choose the device’s language (a great way to test translations, but it is generally not changeable until you start a new session). Basically, SAMSUNG asks that you clean up any of your test files and data from the device before exiting so that they do not get cluttered with test content or interfere with other users. The devices are not reset after each session so it is relatively common to find remnants of past testers when connected, including their own signed-in accounts at times.

SAMSUNG Test Device

The test device after initially launching it.

From here out, you can interact with the device’s screen using your mouse to simulate touch. Some devices may support alternative touch simulators such as the use of a stylus. In my test cases, I did come across a couple devices that would not respond to mouse control due to various causes including a prior tester changing the unlock method (another reason why trying them without being signed-in first is a fine idea).

Uploading and Installing your App

The SAMSUNG simulator software uses right-click context menus to configure its setup and manage applications.

  • Right-click on the device’s screen to adjust screen properties including device orientation, and to capture screenshots and video.
  • Right-click on the device’s frame (chrome) to access test-related controls including app management and logs.

To easily upload, install and run your app to the device, do as follows:

  1. Right-click on the device’s frame (i.e., on the SAMSUNG logo in the screenshot above).
  2. From the context menu, select Manage > Application to load the Application Manager.
  3. From the Application Manager view, click New and then double-click on your desired APK to upload it.
  4. With your uploaded app selected in the Application Manager list, click Install.
  5. Once installed, make sure the test device is unlocked and that your app is selected in Application Manager, then click Start.
    1. You can alternatively browse to the application directly on the device, once installed, to launch it.

If all was successful, your app should then launch and you will be able to interact with it as if using a real device. If the device does not have working WiFi connectivity, simply right-click on the frame and select Manage > Reset WiFi. You can switch the orientation to landscape by right-clicking the screen and selecting Orientation > Landscape.

SAMSUNG Test Device Scribblify

The SAMSUNG device with my development app (Scribblify) installed.

Advanced Tools

The test device environment supports device logging akin to LogCat in Eclipse / ADB. To view the logs, you can right-click the device frame and select Test > Logs. All of the logs will then appear in a new window and can be filtered by log level and/or string. You can also clear the log or save the data to a file just as you could from Eclipse. In addition, the SAMSUNG devices support remote debugging by selecting Test > Remote Debug Bridge and then connecting to it from your local ADB shell (this is the same manner described in my BlueStacks tutorial).

When you have completed your tests, you can uninstall your app(s) from the Application Manager by selecting it and clicking Uninstall. To exit the emulator, right-click the frame and select Exit. Finally, it is a polite gesture to then cancel the reservation in the SAMSUNG Test Lab site (under “My Reservations“) so that the device can be used by other parties before the entire duration is up.

This free service is tailored to SAMSUNG devices and does not have nearly the number of available devices as some of the paid services mentioned previously. Even so, it offers a wide-enough spectrum of test devices to rather adequately test most of the problem areas of device. Another very promising and free cloud testing service on the horizon is Google’s Cloud Test Lab, which promises to offer virtual access to many devices as well as advanced automated tests. This service is not yet available publicly but is certainly worth keeping tabs on.

Fastest Way to Delete Large Folders in Windows

How to Speed Up Folder Deletion Times by 20x or More!

Windows Fast Delete FileThe common way of deleting files and folders in Windows is via Windows Explorer (a.k.a. File Explorer). This method is perfectly acceptable under normal circumstances, but becomes a real drag when dealing with large and complex folder structures. There is, in fact, a significant amount of of overhead when you trigger the standard delete action in Windows including when either emptying the Recycle Bin or directly deleting files via Shift+Del.

Upon flagging a folder for deletion in the traditional fashion, Windows begins by calculating the total folder size, number of items contained within it, and the estimated completion time. This “Preparing to Delete” phase can consume a sizable amount of time itself depending on the contents being deleted. During the actual deletion process, Windows continues to query and report various statistics about the process including how many items are deleted per second, how many remain, the current item being deleted and so forth. You may also be prompted via the Windows dialog if any conflicts arise during the process.

As an example of folder complexity, I have recently been doing a lot of tests with various iterations of the Android NDK across several development machines. The latest Android NDK (r10e) is comprised of around 50,000 Files across 4,100 Folders and totals over 3.15GB in size. Deleting this directory in its extracted format can take up to fifteen minutes when using native Windows Explorer file operations, versus just seconds using the method described below.

Fast Delete Folder

Deleting a large and complex folder via Windows Explorer can take a long time.

A much faster, bare metal approach to deleting large and complex folders in Windows is via the command line. Of course, repeatedly having to navigate directories while executing commands via a terminal quickly becomes a tedious experience. In this post, I will walk through the process of creating a simple batch file and wiring it up to a handy right-click context menu from Windows Explorer to delete sophisticated directories in a hurry and without interruption.

Deleting Files and Folders via Command Prompt

The commands required to perform folder and file delete operations via Command Prompt are quite straightforward.

Files can be deleted using the DEL (a.k.a. ERASE) command.

There are a handful of optional parameters that can be appended to the DEL command to control its behavior. To see a description of each, enter DEL /? from the command prompt. The most important flags when wishing to delete all files across all nested directories include:

  • /F – Force deleting of read-only files.
  • /Q – Quiet mode, do not ask if ok to delete on global wildcard.
  • /S – Deletes specified files from all subdirectories.

To delete all files in a particular directory and its subdirectories, you would first navigate to the directory in question using cd [PATH] and then execute the following line:

If you omit the /Q flag, you would have to manually verify the deletion of every single file—obviously not what you want when trying to delete a folder’s contents as quickly as possible. Likewise, without the /F flag, any files set to read-only would be ignored and would remain in-tact after the command has completed. The /S flag is significant as without it you would only be deleting all of the files in the root active directory.

While this method avoids the calculation expense required when deleting through Windows Explorer, the command as shown above will still output the location and deletion status of each file in the iteration. Although this can prove valuable at times, when iterating through thousands of files such output can congest the command’s performance. We can instead redirect output to a null location to avoid any on-screen rendering, as such:

Although it may seem like a moot point, the speed gained by merely omitting output is still quite measurable especially when deleting a massive number of items. Upon deleting the ~46,000 files from the NDK package, it took 38 seconds with console output enabled and 29 seconds with output disabled on a standard non-SSD hard drive, scraping off a quarter of the time. By comparison, the same deletion process via a standard Shift+Del in Windows Explorer took an agonizing 11 minutes.

Therefore, using the above command-line operation was over 20 times faster than going through Windows Explorer itself. [Note: When sending a folder to the Recycle Bin via Windows Explorer, it may seem to delete fairly fast on modern editions of Windows, but will still take substantial time when emptying from the Recycle Bin.]

Folders can be deleted using the RMDIR (a.k.a. RD) command.

Like the DEL command, There are a couple optional parameters that can be appended to the RMDIR command to control its behavior. Both of these flags are essential when wishing to delete a folder and all of its sub-folders as fast as possible with no prompts:

  • /Q – Quiet mode, do not ask if ok to remove a directory tree
  • /S – Removes all directories and files in the specified directory in addition to the directory itself.

Technically, the RMDIR command with the above flags should be sufficient enough on its own to remove an entire directory tree in most cases. However, Microsoft’s documentation warns that this command “cannot delete a directory that contains files, including hidden or system files.” I believe that this statement is more applicable to older operating systems such as XP, likely to resolve malicious security flaws from the older DELTREE and PURGE commands. Regardless, I still prefer to run the DEL command described previously to ensure each file including read-only has been forcibly deleted before deleting the folders themselves via RMDIR. There is no measurable speed penalty for using both commands over just one.

To delete a particular directory and all of its subdirectories, you must enter the command:

Note that this command will not work if you are currently in the directory trying to be deleted. Instead you should navigate to the parent directory via CD.. and then call the command by referencing the target folder.

Let’s Make a Batch File

To enable this functionality without having to continuously enter these commands, we will make a self-contained batch file. I recommend creating a dedicated folder on your hard drive to store small utility programs and batch files, such as ‘C:\Programs‘. Launch Notepad and paste the following snippet into it.

When done, select File > Save As and save it as “fastdel.bat” in quotes to your folder of choice (i.e., C:\Programs\). I have added a very basic prompt via the PAUSE command to allow a single opportunity to abort the deletion process. As soon as you press any key [except CTRL+C to abort or pressing ‘X‘ in corner to close window] the files and folders will be permanently and immediately deleted with the only possible chance of recovery via a third party software recovery application.

This batch file uses the currently active directory as the one to delete. It first stores this working directory in the FOLDER variable, then navigates to the root drive directory to avoid any operation conflicts. The DEL and RMDIR commands are then called on the original folder and the window will terminate upon completion. Be warned that if you double-click the batch file directly, the folder it resides in will be the target of deletion, so it would delete itself and any siblings or descendants! If you are exceptionally concerned about misfiring this batch file, you could create a more advanced ‘Yes/No’ confirmation prompt for verification using basic batch file commands.

To enable calling of this fast delete batch file from any computer directory, add the file’s directory location to your PATH environmental variable as follows:

  1. Press WINDOWS KEY + PAUSE/BREAK on your keyboard to open the System Information screen.
  2. Click on the Advanced System Settings link on the left.
  3. Under the Advanced tab in the System Variables section, double-click the PATH variable row.
  4. At the end of the Variable Value field, ensure there is a semicolon (;) and then add the full directory location to the batch file (i.e., C:\Programs\).
  5. Click OK to close the Edit System Variable prompt, OK again to close the Environmental Variables window, and OK again to close the System Properties.

With this in place, you should be able to open a new command prompt, navigate to any directory you wish to delete, then type FASTDEL to launch the folder deletion process.

Add Fast Delete Option to the Right-Click Context Menu

All that remains is to add an option to Explorer’s Context Menu so that we can right-click any folder and select Fast Delete from the pop-up menu. This adds the convenience of not having to manually launch a Command Prompt window or enter any console commands yourself. You’ll have to dig into the Registry to accomplish this, but it is very simple:

  1. Press WINDOWS KEY + R on your keyboard to open the Run dialog box.
  2. Enter regedit and press ENTER.
  3. Navigate to HKEY_CLASSES_ROOT\Directory\shell\
  4. Right-click on the yellow shell key and select New > Key.
  5. Enter the name: Fast &Delete then press ENTER.
  6. Right-click on the yellow Fast &Delete folder just created, then select New > Key.
  7. Enter the name: command then press ENTER.
  8. Left-click on the yellow command key just created, then double-click the (Default) entry.
  9. In the Value Data field, enter: cmd /c “cd %1 && fastdel.bat” then press OK.

Fast Delete


Now when you open Windows Explorer / My Computer and navigate to a directory you wish to delete, you can right-click on it and should see the “Fast Delete” option in the menu. The ampersand before the ‘D‘ when creating the key is optional, but will allow you to simply press ‘D‘ after right-clicking a folder to call the fast delete command. WARNING: If you use this keyboard shortcut instead of simply left-clicking the command option, the PAUSE line in the batch file I provided will override and the folder will delete immediately. Again, for safety reasons you may wish to implement a more elegant Yes/No prompt as suggested earlier; as a power user I prefer things to happen quickly with as little user input as necessary.

Note: If you have Cygwin installed and configured, you can also remove directories and files via rm -rf [path]. However, my own tests did not reveal any measurable speed improvements over the integrated method described in this article.

November 16, 2015 Update: I recently observed that the original batch file script I provided above did not compensate for paths with spaces in them. For example, if you had two folders ‘Test‘ and ‘Test Two‘ and right-clicked ‘Test Two’ to delete via the script, it would actually find the ‘Test’ folder and delete its contents instead. This has been amended by surrounding the paths in quotes.