11-16-2010, 08:12 AM
1.
Start from 'Enumerate files' dialog, which is in the floating toolbar. It inserts some code. Edit it. Example:
Macro Macro1118
Or use function GetFilesInFolder. Easier but less flexible, eg you cannot see progress.
2.
3.
4.
str s
foreach s sData
,out s
5.
6.
Quote:The part I'm stuck with is this-how do I start?
Start from 'Enumerate files' dialog, which is in the floating toolbar. It inserts some code. Edit it. Example:
Macro Macro1118
out
Dir d
foreach(d "C:\*" FE_Dir 0x6)
,str sPath=d.FileName(1)
,if(d.FileAttributes&FILE_ATTRIBUTE_DIRECTORY)
,,;out "-------- folder: %s" sPath
,else
,,sel sPath 3
,,,case "*\$Recycle.Bin\*" continue
,,,case ["*.log","*.txt"]
,,,case else continue
,,out sPath
,,;long size=d.FileSize
,,;str sData.getfile(d.FileName(1));; err out "cannot open: %s" sPath; continue
Or use function GetFilesInFolder. Easier but less flexible, eg you cannot see progress.
2.
Quote:How do I create the folder selection menu?To display standard folder selection dialog, use function BrowseForFolder. More difficult would be to select multiple folders.
3.
Quote:How do I create a new file to write to?If need CSV format, use ICsv interface. Add rows, and call function ToFile. It also supports appending, in case if will be too big for memory.
4.
Quote:how do I go through each folder file-by-file and line-by-line and only copy the lines that match the criteria ?See #1. To get line-by-line, use foreach.
str s
foreach s sData
,out s
5.
Quote:How do I get the name of the parent folder?str sFolder.getpath(sPath "")
6.
Quote:How do I make sure that it doesn't get stuck?Use out to display paths in QM output. Press Pause to stop.
