OK, i made a program that you can drag and drop mp3 files to it and it's write there's name.

i want that when i will click the button "Save" it will save the mp3 files with the new name in the Desktop.
how can i do it?

there is a code for download.

or if you want here:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
using System.Xml;
using System.Net;
using System.Diagnostics;
using System.Globalization;
using System.Threading;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void listView1_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
                e.Effect = DragDropEffects.Copy;
        }
        private void listView1_DragDrop(object sender, DragEventArgs e)
        {
            listView1.Items.Clear();
            string[] handles = (string[])e.Data.GetData(DataFormats.FileDrop, false);
            foreach (string s in handles)
            {
                if (File.Exists(s))
                {
                    if (string.Compare(Path.GetExtension(s), ".mp3", true) == 0)
                    {
                        AddFileToListview1(s);
                    }
                }
                else if (Directory.Exists(s))
                {
                    DirectoryInfo di = new DirectoryInfo(s);
                    FileInfo[] files = di.GetFiles("*.mp3");
                    foreach (FileInfo file in files)
                        AddFileToListview1(file.FullName);
                }
            }
        }
        private void AddFileToListview1(string fullFilePath)
        {
            if (!File.Exists(fullFilePath))
                return;
            string fileName = Path.GetFileName(fullFilePath);
            string dirName = Path.GetDirectoryName(fullFilePath);
            if (dirName.EndsWith(Convert.ToString(Path.DirectorySeparatorChar)))
                dirName = dirName.Substring(0, dirName.Length - 1);
     
            ListViewItem itm = listView1.Items.Add(fileName);
            itm.SubItems.Add(dirName);

        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            for(int item = 0; item < listView1.Items.Count; item++)
            {
                try
                {
                    listView1.Items[0].Text = textBox1.Text + " 1";
                    listView1.Items[1].Text = textBox1.Text + " 2";
                    listView1.Items[2].Text = textBox1.Text + " 3";
                    listView1.Items[3].Text = textBox1.Text + " 4";
                    listView1.Items[4].Text = textBox1.Text + " 5";
                    listView1.Items[5].Text = textBox1.Text + " 6";
                    listView1.Items[6].Text = textBox1.Text + " 7";
                    listView1.Items[7].Text = textBox1.Text + " 8";
                    listView1.Items[8].Text = textBox1.Text + " 9";
                    listView1.Items[9].Text = textBox1.Text + " 10";
                    listView1.Items[10].Text = textBox1.Text + " 11";
                    listView1.Items[11].Text = textBox1.Text + " 12";
                    listView1.Items[12].Text = textBox1.Text + " 13";
                    listView1.Items[13].Text = textBox1.Text + " 14";
                    listView1.Items[14].Text = textBox1.Text + " 15";
                    listView1.Items[15].Text = textBox1.Text + " 16";
                    listView1.Items[16].Text = textBox1.Text + " 17";
                    listView1.Items[17].Text = textBox1.Text + " 18";
                    listView1.Items[18].Text = textBox1.Text + " 19";
                    listView1.Items[19].Text = textBox1.Text + " 20";
                    listView1.Items[20].Text = textBox1.Text + " 21";
                    listView1.Items[21].Text = textBox1.Text + " 22";
                    listView1.Items[22].Text = textBox1.Text + " 23";
                    listView1.Items[23].Text = textBox1.Text + " 24";
                    listView1.Items[24].Text = textBox1.Text + " 25";
                    listView1.Items[25].Text = textBox1.Text + " 26";
                }
                catch
                {
                    return;
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
              //This is the Save Button
        }
    }
}

I'm not sure I understand the question. Do you know how to write to a file?

not so well, i mean i did it but i have some problems so i need you for help me

look the program is for my dad, he asked me to do something like that for him,
so i started and i was stopped at this point i have problem with my code to save file with new name

someone can help me?? this is me IDC_Sharp (new account)

Ok, I saw this post of yours, and what I want now is a decent explanation of the problem. I will not even look into code of yours, but I need some words what you need to do. Simple.

again this is me IDC_Sharp (new account) hh
ok i made a listView, a textBox, and 2 buttons:

- listView1
- textBox1
- button1
- button2

now i made the code that you can drag mp3 files from your computer into the listView
the listView shows the name and the path (c:/what ever/what ever/song.mp3)
when i click button1 it's change the name of the items in the listView to the text of the textBox and it's add number i mean
if the song call "ABC"
and i put in the textBox "DEF"
and the index is 0
this specific item will change his name to "DEF 1"; (the indexes starts with 0 so the name will be everytime bigger with 1 - you can see the code above).

Until now i made everything ok.

__________________________________________

now i want that when i will click on button2 it will save those mp3 files with there's new name somewhere else.
and i had problem with the code so i came to here

You mean to save files some place else on the hdd?

hdd? what is that mean?
but yes i mean that i want it will copy the files to other location with new name

hdd = hard disc drive :)
About your code:
You can create a FileInfo array, and save them on the other location.
Does your listView has only one column or two? (fileName, and full file path)

2 columns(fileName, and full file path)

I did a code, but didnt test it, becuase I did use any real files in example:

private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < listView1.Items.Count; i++)
            {
                var someFile = new FileInfo(listView1.Items[i].Text);
                File.Move(someFile.FullName, listView1.Items[i].SubItems[1].Text);
                //the point is, that you have to specify two things inside the brackets:
                //1. Source file name (path where is the file now)
                //2. New file path!
            }
        }

actually this is where i was stopped in the beginning.
your code mean that it will copy them with the new name to the same location of the file
i want that it will copy them in the Desktop
so i made 1 more column.
every item will got 1 more subitem that have always the text "C:/Users/what ever/Desktop"
so i tried to save them but there is more problem like what it was error about your code
_____________________________________________
Could not find file
'C:\Users\What Ever\Desktop\MusicFilesMixer\MusicFilesMixer\bin\Release\song 1.mp3'
_____________________________________________

Nevermind i finally success to do that!!! it's was a fucking silly mistake!!
hhh thank you anyway.
if you want to the code i will send you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.