cleaning up a folder - TIP for today
Nancy Palmquist
nlp at vss3.com
Wed Oct 28 07:10:11 PDT 2009
This routine does two things. You could pick from those as required. It
removes all the files from a folder that have an extension of .pcl If
you take out the system commands that do the rmdir you could stop there,
and just clean up those files. Or you can use the combination of ideas.
I expect, I could have removed all the contents with just one windows
command, but I left the logic like this so you could see how to use
filePro to remove files selectively. You may just want to clean up some
files in a folder.
I hope you find this interesting.
85 ------- - - - - - - - - - - - - - - - -
? If: 'DOS Based logic - but could easily be adapted to *NIX systems ?
Then: declare filename, pclfolder ?
86 ------- - - - - - - - - - - - - - - - -
clearit? If: ?
Then: pclfolder=xlate(pclfolder,"/",chr("92")) ?
87 ------- - - - - - - - - - - - - - - - -
? If: ?
Then: zb(8,.0)=opendir("*.pcl",pclfolder);zc(8,.0)="1" ?
88 ------- - - - - - - - - - - - - - - - -
? If: zb lt "1" ?
Then: zb=closedir();system "rmdir /q/s"<pclfolder ;return ?
89 ------- - - - - - - - - - - - - - - - -
doanoth? If: zc gt zb
Then: zb=closedir(); system "rmdir /q/s "<pclfolder;return
90 ------- - - - - - - - - - - - - - - - -
? If:
Then: filename=pclfolder{"\ "{@dirlist_name[zc]{".pcl"
91 ------- - - - - - - - - - - - - - - - -
? If:
Then: za(8,.0)=remove(filename{"")
92 ------- - - - - - - - - - - - - - - - -
? If:
Then: zc=zc+"1";goto doanoth
93 ------- - - - - - - - - - - - - - - - -
? If:
Then: return
More information about the Filepro-list
mailing list