Page 1 of 1

grouping list of files

Posted: Thu Sep 11, 2008 10:25 pm
by Eelco
Hi there!
I've got this list of files (simple dir /s /b > list.txt in command prompt)
Now I need to group them by subdirectory.
here's a small example:

Winter2008_2009
zomer2009
Winter2008_2009\Bijzonderetassen
Winter2008_2009\Damesmode
Winter2008_2009\Bijzonderetassen\L1000405.JPG
Winter2008_2009\Bijzonderetassen\L1000406.JPG
Winter2008_2009\Bijzonderetassen\L1000407.JPG
Winter2008_2009\Bijzonderetassen\L1000408.JPG
Winter2008_2009\Bijzonderetassen\L1000409.JPG
Winter2008_2009\Bijzonderetassen\L1000410.JPG
Winter2008_2009\Bijzonderetassen\L1000411.JPG
Winter2008_2009\Damesmode\Bandje
Winter2008_2009\Damesmode\hakje
Winter2008_2009\Damesmode\Bandje\L1000317.JPG
Winter2008_2009\Damesmode\Bandje\L1000519.JPG
Winter2008_2009\Damesmode\Bandje\L1000563.JPG
Winter2008_2009\Damesmode\Bandje\L1000739.JPG
Winter2008_2009\Damesmode\hakje\L1000363.JPG
Winter2008_2009\Damesmode\hakje\L1000364.JPG
Winter2008_2009\Damesmode\hakje\L1000426.JPG
Winter2008_2009\Damesmode\hakje\L1000427.JPG
Winter2008_2009\Damesmode\hakje\L1000634.JPG

What I now need is actually a group of output files with in each file ONLY the JPG's with relative path.
So that would be a file containing :
Winter2008_2009\Bijzonderetassen\L1000405.JPG
Winter2008_2009\Bijzonderetassen\L1000406.JPG
Winter2008_2009\Bijzonderetassen\L1000407.JPG
Winter2008_2009\Bijzonderetassen\L1000408.JPG
Winter2008_2009\Bijzonderetassen\L1000409.JPG
Winter2008_2009\Bijzonderetassen\L1000410.JPG
Winter2008_2009\Bijzonderetassen\L1000411.JPG

and a file containing
Winter2008_2009\Damesmode\Bandje\L1000317.JPG
Winter2008_2009\Damesmode\Bandje\L1000519.JPG
Winter2008_2009\Damesmode\Bandje\L1000563.JPG
Winter2008_2009\Damesmode\Bandje\L1000739.JPG

and so on and so on.
When I have those files I need to convert these paths and files to HTML code, but we'll see that when we get there.
I've tried something with 'jpg' [mustendwith (cr or lf)], but that just selected the 'JPG' part, not the whole line.
The idea was to insert something like "####" at the beginning of the line and then delete all the lines not starting with "####" but now that I read this back, it is in fact the same as deleting all the lines not ending in "JPG"... oh my I start to sound incoherent. :?

Bottom line: how can I remove at least the lines that contain just the subdir path and not a filename ending with JPG, and is it possible to split them up into different output files?
hope to hear soon,
Eelco
Oh, I purchased TextPipe Lite Single User, so I think all the Pro options are out of my reach... :wink:

Re: grouping list of files

Posted: Thu Sep 11, 2008 11:19 pm
by Eelco
OK, got some further now:
I applied a perl filter to the text:

^.*?jpg$

I sent the non-matching lines to a subfilter:

^.*$

after which I chose the action "Remove" from the dropdown box.
This left me with just the lines with folders actually containing files.

Then I added the filter "Remove blank lines" and now I've got a whole bunch of filenames in one big file.
So now the latter part: is it possible to put this in different files based on the folder name?

Re: grouping list of files

Posted: Fri Sep 12, 2008 4:21 pm
by DataMystic Support
Sure - use the Restriction to select just one set of files, and inside it use a Secondary Output Filter followed by a Remove All filter.
Then use the final output filter to collect the remaining files.

e.g.

Code: Select all

|   
|--Restrict to lines matching []
|  |
|  |--Merge output to file c:\a.txt
|  |   
|  +--Remove all
|      
|--Restrict to lines matching []
|  |
|  |--Merge output to file c:\b.txt
|  |   
|  +--Remove all
|      
|--Restrict to lines matching []
|  |
|  |--Merge output to file c:\c.txt
|  |   
|  +--Remove all
|      
+--Merge output to file c:\remainder.txt
    


Re: grouping list of files

Posted: Sun Sep 14, 2008 7:04 am
by Eelco
hmmmm..... Feeling rather blonde here...
I understand what you mean, but how can I use the example? I am not quite familiar with the whole clipboard technology, and now I tried copying and pasting the example in the clipboard and get the input from the clipboard:

TextPipe Single User Edition
Purchased by: Eelco de Vries, Eelcodevries.nl

Filter Title:

Filter List
-----------
Filter options
| [ ] Log to file
| [X] Append to logfile
| Log filename: textpipe.log
| Threshold 500
|
|--Input from clipboard
|
|--Comment...
| Click >>Here<< or press F1 for help
|
| TextPipe uses 'filters' to perform changes to each file. This 'filter list' is a sequence of changes, like 3 different search and replace operations.
|
| You can add filters from the Filter menu above - Convert, Add, Remove, Unicode, Replace, Special, Maps, Email, Restrict.
|
| For:
| * Search/replace - look in the Replace Menu
| * Unix/DOS/Mainframe End-of-line conversion - look in the Convert Menu
| * Extract email addresses - look in the Email Menu
| * Remove HTML codes - look in the Remove Menu
| * Join (merge) files together - look in the Special Menu
| * Split files apart - look in the Special Menu
| * Join files and then sort them - add a Special Menu\Merge filter followed by a Special Menu\Sort filter
|
| Just click the menu item to add the filter to the list.
|
| You'll find many examples just by clicking File\Open, or you can use File\Search to locate a filter.
|
| You can also ask questions in the TextPipe Discussion Forums -
| http://www.crystalsoftware.com.au/forums
|
|
|--Restrict to lines matching ['Dames mode/klittenband']
| |
| |--Merge output to file c:\a.txt
| |
| +--Remove all
|
|--Restrict to lines matching ['Dames mode/Korte laar']
| |
| |--Merge output to file c:\b.txt
| |
| +--Remove all
|
|--Restrict to lines matching []
| |
| |--Merge output to file c:\c.txt
| |
| +--Remove all
|
+--Merge output to file c:\remainder.txt
|
+--Output to file(s)
[ ] Only update date on changed files
[ ] Append mode
[ ] Change extension to: .txt
[ ] Open output file
Only output modified files Backup mode

Files List
----------
D:\Websites\Wonink Dieren\Foto's nieuwe collectie wonink schoenmode\lijst.txt.txt

However, the program complains that there is no filter.
So, to the point: how can I build a filter with Textpipe Light that works like the above example?
Again: feeling rather blonde here.... :oops: :oops: :oops:

Re: grouping list of files

Posted: Mon Sep 15, 2008 11:24 pm
by DataMystic Support
You need to add the filters above, then drag them into the structure shown. There's no clipboard magic for this one yet - but it is coming!

Please try the attachment

Re: grouping list of files

Posted: Mon Sep 15, 2008 11:52 pm
by Eelco
Hi there!
thanks for the swift support!
However.... this solution doesn't seem to work with me. I've tried dragging filters in such a tree structure, but I couldn't find them. So I took your advise and got the zipfile and tried it with that.
And Lo and Behold.... still nothing. However, the problem became more clear as why I couldn't find the needed filters: I need to have TextPipe Pro, and I just have 1 x TextPipe Lite Single User License Receipt number: xxxxx

So, any further suggestions (other than upgrading to the Pro version for $365? :wink: )

Re: grouping list of files

Posted: Tue Sep 16, 2008 11:30 pm
by DataMystic Support
You'll need at least TextPipe Standard ($199) to do this one. You can upgrade here: http://www.datamystic.com/buy/textpipelite.html - enter a conversion amount of 169.