Sign in to follow this  
Followers 0
BoogY

FilaPath problem

3 posts in this topic

Hi there everyone...

I have a litle problem with the FileSelectFolder function.

I made a backup program that is asking you where you want to save the backup fiele. Everithing works great there.But when I chose a path like a USB key ex: F:\ it works ok.

If I chose the desktop for example I get ex: C:\Documents and Settings\USERNAME\BureauBACKUPFILE without the "\". If I want it to return the full path with the "\" I put a \ in front of my variable. Ok It works on the desktop but no more on the USB Key.. It gives me ex: F:\\BACKUPFILE

How can i check with StringRegExpReplace or StringRegExp to delete the \ if it exists ?

Here is the part of the scrypt:

Local $chemin = FileSelectFolder("Veuillez choisire l'endroit pour copier la sauvegarde","")

    If StringInStr($chemin,"\\") Then
        $Dest = $chemin & $backupName
    Else
        $Dest = $chemin & "\" & $backupName
    EndIf

Thanks a lot for your help

Share this post


Link to post
Share on other sites



Ok I found my problem and I dit'it like this

Local $chemin = FileSelectFolder("Veuillez choisire l'endroit pour copier la sauvegarde","")
    $Dest = $chemin & "\" & $backupName
    
    If StringInStr($Dest,"\\") Then
        $Dest = $chemin & $backupName
    Else
        $Dest = $chemin & "\" & $backupName
    EndIf

but how can I make'it simpler or use the StringRegExp

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Local $chemin, $Dest, $backupName = "BureauBACKUPFILE"
$chemin = FileSelectFolder("Veuillez choisire l'endroit pour copier la sauvegarde","")
If StringRight($chemin, 1) <> "\" Then $chemin &= "\"
$Dest = $chemin & $backupName

Or

Local $chemin, $Dest, $backupName = "BureauBACKUPFILE"
$chemin = FileSelectFolder("Veuillez choisire l'endroit pour copier la sauvegarde","")
$chemin &= "\"
$Dest = StringReplace($chemin & $backupName, "\\", "\")
Edited by smashly

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0