include sample_top.html
Caravan Business Server>Examples>Folder
Accessing Folders & File Properties
Enter Folder Name *

// caravan script used to validate whether the input folder exists or not. if form(txtfoldername) delete docs folder docs=form(txtfoldername) if docs(exists)<>"yes" "   Folder does not exist!";"" goto repeat; over endif endif // caravan script used to access folder var sql if form(txtfoldername) delete docs // lines below create the a folder object and checks whether it exists. folder docs=form(txtfoldername) if docs(exists)<>"yes" " Folder does not exist!";"" else " Contents of ";form(txtfoldername);"" endif sql(cnt)="0" // line below Specify the type of files to be fetched when finding docs(filespec) = "*.*" loop z (500) // line below checks the type of object ie., it may be file or folder if docs(type)="file" sql(cnt)+="1" "" time createdate // line below accesses the created date assigns to local variable createdate(time)=docs(time) // lines below display various properties like filename, type, size and created date "" "" "" "" "" endif // line below finds the next matching file in the current folder. docs(findnext) repeat z 500 "--";sql(cnt);" files" endif docs(reset)
   Filename    Type    Size (in bytes)    Date
" "";docs(filename);"" "" "";docs(type);"" "" "";docs(size);"" "" "";createdate(date);"/";createdate(month);"/";createdate(year);"" "
label repeat;
  include sample_bottom.html