English
Source / code snippets

Dateiname Pathremovefilespec way Splitfilename separate

 

Michael
Wodrich
Filenames aufdröseln ex Version 10.0 (uses SubStr backward and Match$)
CompileMarkSeparation
SplitFilename  (Test-Schnipsel)
Ab XProfan 10

Proc SplitFilename

    Parameters Vollname$
    Declare Laufwerk$, Pfad$, Datei$, Extension$
    Laufwerk$ = Match$(.:,Vollname$)
    Pfad$ = Match$(~.{0,2}\(.*\)?,Vollname$)
    Datei$ = SubStr$(Vollname$,-1,If(InStr(\,Vollname$),\,:))
    Extension$ = If(InStr(.,Datei$),SubStr$(Datei$,-1,.),)
    AddString Voller Dateiname: q + Vollname$ + q
    AddString Laufwerk + MkStr$(.,8) + : q + Laufwerk$ + q
    AddString Pfad + MkStr$(.,12) + : q + Pfad$ + q
    AddString Dateiname + MkStr$(.,7) + : q + Datei$ + q
    AddString Extension + MkStr$(.,7) + : q + Extension$ + q
    AddString

EndProc

ClearList
SplitFilename C:
SplitFilename Datei
SplitFilename Datei.
SplitFilename C:Datei.ext
SplitFilename C:Datei.ext
SplitFilename C:TestDatei
SplitFilename C:Test.$$$Datei.ext
SplitFilename C:Test.$$$Datei.
SplitFilename C:Test.$$$Datei
SplitFilename .Text.$$$
SplitFilename ....von weiter vorndatei.ext
ListBox$(die Ergebnisse,2)
VVV damit habe ich mal schnell die Ergebnisse abgegriffen
Declare s$,B#
Dim B#,50000
MoveListToMem(B#,
)
BlockWrite C:\Test_Splitfilename.txt,B#,0,Len(String$(B#,0))
Dispose B#
ShellExec(C:\Test_Splitfilename.txt,open,1)
End

and the Results:

Voller Dateiname: C:
drive........: C:
way............:
Dateiname.......:
Extension.......:

Voller Dateiname: File
drive........:
way............:
Dateiname.......: File
Extension.......:

Voller Dateiname: File.
drive........:
way............:
Dateiname.......: File.
Extension.......:

Voller Dateiname: Catei.ext
drive........: C:
way............:
Dateiname.......: File.ext
Extension.......: ext

Voller Dateiname: Catei.ext
drive........: C:
way............:
Dateiname.......: File.ext
Extension.......: ext

Voller Dateiname: C:TestDatei
drive........: C:
way............: Test
Dateiname.......: File
Extension.......:

Voller Dateiname: C:Test.$$$File.ext
drive........: C:
way............: Test.$$$
Dateiname.......: File.ext
Extension.......: ext

Voller Dateiname: C:Test.$$$File.
drive........: C:
way............: Test.$$$
Dateiname.......: File.
Extension.......:

Voller Dateiname: C:Test.$$$File
drive........: C:
way............: Test.$$$
Dateiname.......: File
Extension.......:

Voller Dateiname: .Text.$$$
drive........:
way............: .Text.$$$
Dateiname.......:
Extension.......:

Voller Dateiname: ....of moreover vorndatei.ext
drive........:
way............: ....of moreover in front
Dateiname.......: File.ext
Extension.......: ext
 
Programmieren, das spannendste Detektivspiel der Welt.
06/16/06  
 



[quote:283141f477=Michael Wodrich]
and the Results:
[box:283141f477]
Voller Dateiname: Catei.ext
[/box:283141f477][/quote:283141f477]
there missing one Backslash
you should The Laufwerksbuchstaben too with BackSlash give back, any API-Aufrufe to accept
in general both, means C: and C:, so the it with Backslash uniformly would.
otherwise very useful.
 
06/16/06  
 




Michael
Wodrich
isn't integrally correctly. with the Backslash.

The File can Yes in *each* directory on drive C: his, as they so indicated is.

and it is not The task one Splitters for a complete names To care. then wären namely too The .. any aufgelöst been.

sometimes need one just a Namens-Verhackstücker, because one one part of it replace would like.

correctly would though, whom Filenames from the expansion To release. then reicht one simple add the pieces and one has again Ganzes (therefore: drive only the character and colon).

is with whom Snippets debarked, because one itself there Yes what draus divert can.

In each drop goes it now with XProfan 10 everything something kürzer To write.

Best wishes
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
06/16/06  
 




Jac
de
Lad
Gibts dafpr not too ne API? I mean, if I a Filenames whom way extract wants, I could the degree well use, find the but not.
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
03/07/07  
 




CompileMarkSeparation
DEF @PathRemoveFileSpec(1) !shlwapi,PathRemoveFileSpecA
WindowTitle Dateinamen von Pfad trennen
Windowstyle 31+512
Window 0,0-640,440
Declare EingabeDatei$,Pfad#
Let EingabeDatei$=C:
Dim Pfad#,513

While EingabeDatei$<>

    let EingabeDatei$=@LoadFile$(Bitte Datei auswählen,*.*)
    String Pfad#,0=EingabeDatei$
    @PathRemoveFileSpec(Pfad#)
    Print @String$(Pfad#,0)

03/07/07  
 



Michael Wodrich
isn't integrally correctly. with the Backslash.

The File can Yes in *each* directory on drive C: his, as they so indicated is.


quite correctly because if itself one Process z.B. via chdir  on d: befinded, before but to c:sonstwasirgendwas changed watts - so would The indicated of C:my.File on c:sonstwasirgendwasmeine.File show, instead of on c:my.File.

Michaels Algo working IMHO utterly correctly..
 
03/07/07  
 




Jac
de
Lad
@Andreas: thanks!
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
03/08/07  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

8.720 Views

Untitledvor 0 min.
Rainer Hoefs06/11/23
rafl10/03/14
Christian Hahn07/05/13
maxpayne200104/29/13

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie