$files = get-childitem foreach ($file in $files) { # this like takes the end off of the file name $product_name = $file.name.substring(0, $file.name.length - 4) # split the line at each underscore, since we want to remove them for model name $product_split = $product_name.split('_') foreach ($split in $product_split) { # put model name together $product_model = $product_model + $split # duh. $product_image = $file.name $date_added = get-date -uformat "%Y-%m-%d %H:%M:%S" # we decided to set the date way out there because we don't want people # buying product we don't have, yet. $date_available = "2008-03-31 00:00:00" # I should have set this all in the SQL statement, but didn't. $weight = .01 $manufacturer = 1 # build the query. in order for PoSH to output the grave characters (those single quotes...that key to the left of 1) # you need to put two of them in $sqlquery = "INSERT INTO ``products`` ( ``products_id`` , ``products_type`` , ``products_quantity`` , ``products_model`` , ``products_image`` , ``products_price`` , ``products_virtual`` , ``products_date_added`` , ``products_last_modified`` , ``products_date_available`` , ``products_weight`` , ``products_status`` , ``products_tax_class_id`` , ``manufacturers_id`` , ``products_ordered`` , ``products_quantity_order_min`` , ``products_quantity_order_units`` , ``products_priced_by_attribute`` , ``product_is_free`` , ``product_is_call`` , ``products_quantity_mixed`` , ``product_is_always_free_shipping`` , ``products_qty_box_status`` , ``products_quantity_order_max`` , ``products_sort_order`` , ``products_discount_type`` , ``products_discount_type_from`` , ``products_price_sorter`` , ``master_categories_id`` , ``products_mixed_discount_quantity`` , ``metatags_title_status`` , ``metatags_products_name_status`` , ``metatags_model_status`` , ``metatags_price_status`` , ``metatags_title_tagline_status`` ) VALUES ( '', '1', '0', '$($product_model)', '$($product_image)', '0.000', '0', '$($date_added)', '$($date_added)', '$($date_available)', '$($weight)', '0', '0', '$($manufacturer)', '0', '1', '1', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0.0000', '0', '1', '0', '0', '0', '0', '0');" #write each statement to a file, then import into PHPMyAdmin. add-content c:\ecommerce\SQL.txt $sqlquery $product_model = $null }