• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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