Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

problem posle kopiranja foldera na mesto gde postoji isti sa istim imenom

[es] :: .NET :: problem posle kopiranja foldera na mesto gde postoji isti sa istim imenom

[ Pregleda: 1321 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

tomislav91

Član broj: 206601
Poruke: 316
*.dynamic.isp.telekom.rs.



+1 Profil

icon problem posle kopiranja foldera na mesto gde postoji isti sa istim imenom07.06.2015. u 11:27 - pre 107 meseci
Umesto da i njega ostavi, samo da doda (1), on ne uradi nista, ne izbaci mi ni exception ni nista...
U cemu je problem? On bi treba recimo, ako imam folder Test, da skonta e, postoji taj folder, hoces da sacuvas oba, ako da, on treba da sacuva Test (1).
Sa fajlovima mi sve funkcionise, ali sa folderom ne, u cemu je problem, tj gde je u kodu?

Code:

 If System.IO.Directory.Exists(destinationFolderPath) Then
                        Dim nextAvialableFolderPath As String = GetDestinationFolderPath(txtFolderNetworkPath.Text, System.IO.Path.GetDirectoryName(originalFolderPath))
                    Select Case MessageBox.Show("Fajl vec postoji. Hoces li da zamenis(yes) ili da sacuvas oba (no) ili da prekines operaciju (Close)", "Greska", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
                   

                        Case Windows.Forms.DialogResult.No


                            My.Computer.FileSystem.CopyDirectory(originalFolderPath, nextAvialableFolderPath)






a evo i funkcije
Code:


    Private Function GetDestinationFolderPath(location As String, folderName As String)
        Dim counter As Integer = 0
        Dim desiredFolderPath As String = System.IO.Path.Combine(location, String.Format("{0}", folderName))

        While System.IO.Directory.Exists(desiredFolderPath)
            counter += 1
            desiredFolderPath = System.IO.Path.Combine(location, String.Format("{0} ({1})", folderName, counter.ToString))
        End While
        Return desiredFolderPath
    End Function
     

life is the one,take care of them!

http://hardware-software.serbianforum.info/
 
Odgovor na temu

[es] :: .NET :: problem posle kopiranja foldera na mesto gde postoji isti sa istim imenom

[ Pregleda: 1321 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.