multiple folders

View: New views
3 Messages — Rating Filter:   Alert me  

multiple folders

by Alain Matthes-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I need sometimes to create multiple folders from a
list of names in a file

for example in a file : list_names.txt

January
February
...
December

I would like from textmate use a command like : select the names
  and get the folders.

With bash and without spaces in the names, it's possible to get a result
  with the file list_names.txt (I'm a newbie with bash ! )


#! /bin/bash

for item in `cat list_names.txt`
  do
    mkdir $item
done

But this is not very fine because I can't give the path for output  
folders

1) Is it possible with textmate to create a command and  to give the  
path
  with an interactive action

2) Do you know a Ruby script to make this ? (it's to learn about Ruby)

3) Perhaps "Interactive Input" is an answer to give the path for the  
ouput place
  but I run textmate with Snow Leopard and tm_interactive_input.dylib
  gives me some problem with laTeX.

4) Perhaps with regex, it is possible to determine names with spaces  
inside
  if RC is the separator ?



Then, in these folders,I need to create  a lot of files like
In tkz_graph folder

tkz_graph_example_1.tex
tkz_graph_example_2.tex
...
tkz_graph_example_20.tex

idem with tkz_2d etc ...


To create these files, I use the same LaTeX template and the question  
is the
  like the first one.
  How to create a command with the number of files and
  and the possibility to choice a directory?

An idea was to select "20" and "/Users/ego/work" and to launch the  
command but
I'm not an expert with bash or Ruby to make this ...

Best regards

Alain Matthes


_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate

Re: multiple folders

by Allan Odgaard-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 24 Oct 2009, at 17:42, Alain Matthes wrote:

> [...]
> 1) Is it possible with textmate to create a command and  to give the
> path with an interactive action

Yes, but would involve more work than I am prepared to type in Mail’s  
inline text editor ;)

Basically though you want to use ‘xargs’ instead of the bash loop.  
This reads arguments from stdin and gives them to a command of your  
choice.

> 2) Do you know a Ruby script to make this ? (it's to learn about Ruby)
>
> 3) Perhaps "Interactive Input" is an answer to give the path for the  
> ouput place but I run textmate with Snow Leopard and  
> tm_interactive_input.dylib gives me some problem with laTeX.

If you are having Snow Leopard problems with the latest  
tm_interactive.dylib found in the svn repository, then we would like  
to know about them, as we consider this “fixed” and it will likely go  
out with next build.

> 4) Perhaps with regex, it is possible to determine names with spaces  
> inside if RC is the separator ?

The issue with spaces should be addressed by using proper quoting in  
the bash commands (or ruby script, if you end up using that). Worst-
case one can set the IFS variable to a newline, so that `cat  
filenames.txt` will be word-expanded on newlines (instead of  
whitespace).

Though I am not sure what approach to recommend, as I do not have the  
full picture. E.g. these list of folders to create, where do these  
come from? Cause if these are generated, maybe the generator could  
just make the folders instead of creating lists…


_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate

Re: multiple folders

by Alain Matthes-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le 27 oct. 2009 à 19:45, Allan Odgaard <mailinglist@...> a  
écrit :

> On 24 Oct 2009, at 17:42, Alain Matthes wrote:
>
>> [...]
>> 1) Is it possible with textmate to create a command and  to give the
>> path with an interactive action
>
>
> If you are having Snow Leopard problems with the latest
> tm_interactive.dylib found in the svn repository, then we would like
> to know about them, as we consider this “fixed” and it will  
> likely go
> out with next build.

I try the latest tm_interactive today and it's fine but the bug  
LateXCommandCompletions.rb is always here (fileExt="tex" is necessary )
>
> Though I am not sure what approach to recommend, as I do not have the
> full picture. E.g. these list of folders to create, where do these
> come from? Cause if these are generated, maybe the generator could
> just make the folders instead of creating lists…

I need two things.

First I create a file with the name of students and I need to create a  
folder for each of them. I can save my list and use bash to create the  
folders but I would like to select the names and to use a command or a  
macro. It is not a big problem (except for ruby ) and except the  
problem of the path for the folders.

The second thing is to create multiple files from one file ( sort of  
template ) .tex files with the same prefix in the same folder. I need  
a macro and I need to give two arguments : the prefix and the path of  
the folder.


Best regards

Alain Matthes

_______________________________________________
textmate mailing list
textmate@...
http://lists.macromates.com/listinfo/textmate