File: C:/xampp/htdocs/dropfile/urlDecode2.au3
;Recursive File Lister
#include <Date.au3>
#Include <Array.au3>
#include <GUIConstants.au3>
#Include <File.au3>
#include <String.au3>
;#include <_sql.au3>
#include <INet.au3>
;#include <decode.au3>
;$objErr = ObjEvent("AutoIt.Error","MyErrFunc")
Global $Paused
HotKeySet("^q", "Terminate")
$sDir='';
$sName=''
$i=0
;$sDir=urldecode('newDirj%E5%B1%8B')
;$sName=urldecode('%E8%BF%85%E9%9B%B7')
;msgbox(0,$sDir,$sName)
$k = 0
While $k <= 1000000000000000000000000000
sleep(500)
$k = 1
$pdf_in=("C:\xampp\htdocs\dropfile\php\upload\");;;;;;;;;;��|1
$pdf_out=("C:\xampp\htdocs\dropfile\php\uploads\")
;msgbox(0,"","hi",1)
$MyVar1=($pdf_in)
$FileList11=_FileListToArray($MyVar1, '*.*',1)
if not @Error=4 then
$fa1=$FileList11[0]
Else
$fa1=0
endif
sleep(500)
$FileList21=_FileListToArray($MyVar1, '*.*',1)
if not @Error=4 then
$fb1=$FileList21[0]
Else
$fb1=0
endif
while $fa1<$fb1
$FileList11=_FileListToArray($MyVar1, '*.*',1)
$fa1=$FileList11[0]
sleep(500)
$FileList21=_FileListToArray($MyVar1, '*.*',1)
$fb1=$FileList21[0]
wend
sleep(500)
$FileList=_FileListToArray($MyVar1, '*.*',1)
;_ArraySort($FileList, 0, 1, 0, 0)
if not @Error=4 then
for $i=1 to $FileList[0] step 1
$rr1=($pdf_in&$FileList[$i])
;msgbox(0,$pdf_out,$rr1)
$rpp=urldecode($FileList[$i])
;msgbox(0,$pdf_out,$rpp)
$aArray =StringSplit($FileList[$i], "----",1)
;_ArrayDisplay( $aArray,"arr")
if @Error=1 then
; msgbox(0,"","no file")
exitloop
endif
$sDir=urldecode($aArray[1])
$sName=urldecode($aArray[2])
;msgbox(0,$sDir,$sName)
if $sDir<>'' then
$rr2=($pdf_out&$sDir&"\"& $sName)
;msgbox(0,"check",$rr2)
else
$rr2=($pdf_out& $sName)
endif
;msgbox(0,$rr1,urldecode($FileList[$i])
FileMove($rr1,$rr2,8)
sleep(500)
;msgbox(0,"check","here 2",1)
filedelete($rr1)
;sleep(1000)
next
;ffor
$sDir=''
$sName=''
$i=0
endif
;msgbox(0,"","cycle")
wend
Func Terminate()
;ProcessClose("Wscript.exe")
Exit 0
EndFunc
Func urlencode($str, $plus = True)
Local $i, $return, $tmp, $exp
$return = ""
$exp = "[a-zA-Z0-9-._~]"
If $plus Then
$str = StringReplace ($str, " ", "+")
$exp = "[a-zA-Z0-9-._~+]"
EndIf
For $i = 1 To StringLen($str)
$tmp = StringMid($str, $i, 1)
If StringRegExp($tmp, $exp, 0) = 1 Then
$return &= $tmp
Else
$return &= StringMid(StringRegExpReplace(StringToBinary($tmp, 4), "([0-9A-Fa-f]{2})", "%$1"), 3)
EndIf
Next
Return $return
EndFunc
Func urldecode($str)
Local $i, $return, $tmp
$return = ""
$str = StringReplace ($str, "+", " ")
For $i = 1 To StringLen($str)
$tmp = StringMid($str, $i, 3)
If StringRegExp($tmp, "%[0-9A-Fa-f]{2}", 0) = 1 Then
$i += 2
While StringRegExp(StringMid($str, $i+1, 3), "%[0-9A-Fa-f]{2}", 0) = 1
$tmp = $tmp & StringMid($str, $i+2, 2)
$i += 3
Wend
$return &= BinaryToString(StringRegExpReplace($tmp, "%([0-9A-Fa-f]*)", "0x$1"), 4)
Else
$return &= StringMid($str, $i, 1)
EndIf
Next
Return $return
EndFunc