BoogY Posted April 8, 2010 Share Posted April 8, 2010 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 Link to comment Share on other sites More sharing options...
BoogY Posted April 8, 2010 Author Share Posted April 8, 2010 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 Link to comment Share on other sites More sharing options...
smashly Posted April 8, 2010 Share Posted April 8, 2010 (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 OrLocal $chemin, $Dest, $backupName = "BureauBACKUPFILE" $chemin = FileSelectFolder("Veuillez choisire l'endroit pour copier la sauvegarde","") $chemin &= "\" $Dest = StringReplace($chemin & $backupName, "\\", "\") Edited April 8, 2010 by smashly Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now