Recursive Upload: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
 
No edit summary
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 60: Line 60:
   SetDetailsView hide
   SetDetailsView hide
   StrCpy $path "$EXEDIR"
   StrCpy $path "$EXEDIR"
   StrCpy $url ftp://myftpsite.com/html
   StrCpy $url ftp://login:password@myftpsite.com/html ; /html - path from ftp root
   Call dirul
   Call dirul
   SetDetailsView show
   SetDetailsView show

Revision as of 07:26, 7 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"
  Call dirul
  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 ; /html - path from ftp root
  Call dirul
  SetDetailsView show
 
SectionEnd