Recursive Upload: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 29: | Line 29: | ||
IntCmp $2 1 isdir | IntCmp $2 1 isdir | ||
retry: | retry: | ||
Inetc::put $url "$path\$1" /end | Inetc::put $url/$1 "$path\$1" /end | ||
Pop $2 | Pop $2 | ||
DetailPrint "$2 $path\$1" | DetailPrint "$2 $path\$1" | ||
Line 41: | Line 41: | ||
Push $path | Push $path | ||
StrCpy $path "$path\$1" | StrCpy $path "$path\$1" | ||
Push $url ; if subdir exists on the server | |||
StrCpy $url $url/$1 | |||
Call dirul | Call dirul | ||
Pop $url | |||
Pop $path | Pop $path | ||
cont: | cont: | ||
Line 60: | Line 63: | ||
SetDetailsView hide | SetDetailsView hide | ||
StrCpy $path "$EXEDIR" | StrCpy $path "$EXEDIR" | ||
StrCpy $url ftp://myftpsite.com/html | StrCpy $url ftp://login:password@myftpsite.com/html ; use ...//html for absolute (root) path | ||
Call dirul | Call dirul | ||
SetDetailsView show | SetDetailsView show |
Latest revision as of 13:03, 12 November 2006
Author: Takhir (talk, contrib) |
Description
This is script sample for recursive upload of all files from dir and subdirs.
The Script
Name "Inetc Recursive Dir Upload Test" OutFile "recursive.exe" !include "MUI.nsh" !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" !include "FileFunc.nsh" !insertmacro GetFileAttributes var url var path Function dirul Push $0 ; search handle Push $1 ; file name Push $2 ; attributes FindFirst $0 $1 "$path\*" loop: StrCmp $1 "" done ${GetFileAttributes} "$path\$1" DIRECTORY $2 IntCmp $2 1 isdir retry: Inetc::put $url/$1 "$path\$1" /end Pop $2 DetailPrint "$2 $path\$1" StrCmp $2 "OK" cont MessageBox MB_YESNO "$path\$1 file upload failed. Retry?" IDYES retry Abort "terminated by user" Goto cont isdir: StrCmp $1 . cont StrCmp $1 .. cont Push $path StrCpy $path "$path\$1" Push $url ; if subdir exists on the server StrCpy $url $url/$1 Call dirul Pop $url Pop $path cont: FindNext $0 $1 Goto loop done: FindClose $0 Pop $2 Pop $1 Pop $0 FunctionEnd Section "Dummy Section" SecDummy SetDetailsView hide StrCpy $path "$EXEDIR" StrCpy $url ftp://login:password@myftpsite.com/html ; use ...//html for absolute (root) path Call dirul SetDetailsView show SectionEnd