Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: exclude directory
AddExtender("wsrch34I.dll") topdir="c:\temp" ;xyz used as it is an uncommon extension ;we're not really looking for files handle=srchInit(topdir, "*.xyz", "", "", 16+32) dirlist="" while 1 thisdir=srchNext(handle) if thisdir=="" then break if StrUpper(thisdir)==StrUpper("C:\My Documents\") continue endif message("",thisdir) ;make sure it a dir and not an xyz file if strsub(thisdir,strlen(thisdir),1) != "\" then continue if dirlist=="" then dirlist=thisdir else dirlist=StrCat(dirlist,@tab,thisdir) endwhile AskItemList("subfolders",dirlist,@tab,@unsorted,@single)
Here is another example:
AddExtender("wsrch34i.dll") ;locates 'my documents' dir excludedir = StrCat(shortcutdir("Personal"),"\") dest="D:\temp\" msdir="C:\" hand=srchInit(msdir,"*.doc","","", 8|16|32) while 1 item =srchNext(hand) if item == "" then break ;check if the exclude dir is in the path ;if so continue if StrIndexNC(item,excludedir,1,@Fwdscan) then continue ;if the last character in the string is a '\' ;then its a directory therefore skip it if strsub(item,strlen(item),1) == "\" then continue BoxText("Copying .DOC files") firstrename=FileMapName(item,strcat(Dest,"*.*")) ;If the file already exists add number to the end n=0 While FileExist(firstrename) n = n + 1 firstrename=FileMapName(item,strcat(Dest,"*.*",n)) EndWhile BoxText(Strcat("Source",@tab,item,@CRLF,"Dest",@Tab,firstrename)) FileCopy(item,firstrename, @false) Logfile = FileOpen(strcat(dest,"transfer.txt"), "APPEND") FileWrite(logfile,strcat(item,"->",dest,@crlf)) FileClose(logfile) endwhile srchFree(hand)
Article ID: W14795
File Created: 2001:11:08:12:40:00
Last Updated: 2001:11:08:12:40:00