Autor Beitrag
lodibach
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 29.04.10 20:01 
Hallo, ich möchte eine .mp3 Datei aus einem Ordner auslesen und dannach deren Name ändern.
doch wie schaffe ich das?
Ich nutze die Methode

File.Move(sourcePath, movePath);

und mein Code oberhalb ist:

string sourcePath = oFile.FullName;
string movePath = oFile.FullName;

wobei bei dem dickgeschriebenen der letzte Teil des Pfads gelöscht werden und dannach mit neu gefüllt werden soll.
also
sourcepath : "C:\Sounds\ABCD.mp3"

dann soll movepath kurz so aussehen:
movepath : "C:\Sounds\"

und dann soll der Dateiname neu geschrieben werden.

Danke für eure Hilfe
JüTho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2021
Erhaltene Danke: 6

Win XP Prof
C# 2.0 (#D für NET 2.0, dazu Firebird); früher Delphi 5 und Delphi 2005 Pro
BeitragVerfasst: Do 29.04.10 20:12 
Ganz habe ich nicht verstanden, wie du denken willst; aber ich glaube, die wesentlichen Punkte erkannt zu haben.

1. Unter Path wird nicht nur der Pfad verstanden (also das Verzeichnis), sondern die vollständige Angabe des Dateinamens.

2. Zum Verbinden von Verzeichnis und Dateiname ist Path.Combine zu empfehlen. Das setzt den Backslash richtig dazwischen und kann auch Sachen wie "..\" berücksichtigen.

Jürgen
lodibach Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 29.04.10 20:25 
danke :D hat mir sehr geholfen :D