• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

Sort/Upload Pictures from file

Hi,

I have a File that has all my Item Pictures. There is about 28000 Pictures in the file. We have now downsized to about 390 Items.
How can I sort through my pictures, selecting ONLY the 390 Pictures and move them to a location of my choosing without doing it one by one.
I can write an application to do that, but I don't even know where to start, for I am a beginner.
Thanks
0
ALawrence007
Asked:
ALawrence007
  • 6
  • 4
1 Solution
 
McExpCommented:
What is your file format?

WHat select criteria do you intend to use to pick the 390 items you want?
0
 
ALawrence007Author Commented:
I have my items in my SQL database. I have the Picture NAME in the database as well. The pictures (.JPG) is located in a picture folder.
0
 
McExpCommented:
So you need a program that for each item in your database it does a File.Move(OldFileLocation,NewFileLocation)?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
McExpCommented:
How much support do you need to impliment this?
0
 
ALawrence007Author Commented:
That is correct.
0
 
McExpCommented:
Something like this should do the trick?

            string OrigLocation = "c:\\OldDir\\";
            string NewLocation = "c:\\NewDir\\";

            using (OleDbConnection conn = new OleDbConnection())
            {
                using (OleDbCommand comm = new OleDbCommand("SELECT NAME FROM TABLE"))
                {
                    OleDbDataReader rs = comm.ExecuteReader();
                    while (rs.Read())
                    {
                        string Name = rs.GetString(rs.GetOrdinal("NAME"));
                        File.Move(string.Format("{0}{1}.jpg", OrigLocation, Name), string.Format("{0}{1}.jpg", NewLocation, Name));
                    }
                }
            }
0
 
McExpCommented:
You will also need to specifiy a connection string

using (OleDbConnection conn = new OleDbConnection(<InsertConnectionStringHere>))
0
 
ALawrence007Author Commented:
McExp,

I get an error saying File is not declared.
0
 
McExpCommented:
you also need the statment "using System.IO;"
0
 
ALawrence007Author Commented:
Thanks McExp!

That did what I wanted!
0
 
mankowitzCommented:
Another option is to do it from the command line

> mysql -uUSER -pPASSWORD -e"SELECT CONCAT('MOVE C:\OldDir\\', filename, ' C:\NewDir\', filename)" | cmd

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now