Ask Your Question
0

Associating a group of files [closed]

asked 2012-10-05 09:39:03 +0200

ChrisOfBristol gravatar image

updated 2013-06-14 23:39:18 +0200

manj_k gravatar image

This would be like creating a project - I'd like to associate several different types of documents together, so that I can open one main document then click an option to get a list of documents within that project.

For example a report which associates two spreadsheets and three documents. Ideally opening one would open all of them, so that the whole report is available to work on and I can just swap windows from one to another.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-18 04:09:06.283781

4 Answers

Sort by » oldest newest most voted
0

answered 2012-10-05 18:30:56 +0200

ChrisOfBristol gravatar image

updated 2012-10-06 09:59:17 +0200

Thanks mjjzf and w_whalley for stimulating my thought processes. Here is the final script, I hope someone finds it useful:

#!/bin/bash
echo There are no guarantees on its actions.
echo For example it needs a limit on the number of files it opens.

project=$(basename "$0")
project=${project%.*}
length=${#project}

for fn in *; do
  ext=${fn#*.}
  file=${fn:0:length}

  if [ "$file" = "$project" ] ; then
    if [ "$ext" = "odt" -o "$ext" = "ods" ] ; then
      echo "$fn"
      libreoffice "$fn" &
    fi
  fi

done

Check that all the files you want associated with the project and opened at the same time start with the same name and are .ods or .odt ones. Save the script into the directory with the same name, give it the executable property.

Double-click on the script to open all the files but no others, example:

club files.sh

club files.ods

club files.odt

club files spreadsheet 1.ods

club files spreadsheet 2.ods

club files document 1.odt

club files document 2.odt

edit flag offensive delete link more
0

answered 2012-10-05 12:18:50 +0200

mjjzf gravatar image

updated 2012-10-05 12:22:57 +0200

How about just linking or embedding them in, say, a Writer document?

edit flag offensive delete link more
0

answered 2012-10-05 12:26:50 +0200

ChrisOfBristol gravatar image

I'm not sure what you mean by embedding, do you mean putting a hyperlink into each document for each of the others?

Is so, it would be a work round, although perhaps a little clumsy, as adding a new file would require adding a link to it in each file.

edit flag offensive delete link more

Comments

I was just thinking you could have a main index document with links to the others.

mjjzf gravatar imagemjjzf ( 2012-10-05 12:44:21 +0200 )edit

mjjzfI I've tried that in the past and it's not what I want - but your ideas are helping my thought process in working out what I do want!

ChrisOfBristol gravatar imageChrisOfBristol ( 2012-10-05 12:50:42 +0200 )edit
0

answered 2012-10-05 13:35:27 +0200

ChrisOfBristol gravatar image

updated 2012-10-05 14:56:14 +0200

I don't want to have to maintain a list of links. In fact if I just put all the files in the same directory there wouldn't be any need to, because that is an association in itself. What I need then is to open them all at once with one action.

What I need is a script which when run will open all files in a directory using their associated applications. I've just found this very good webpage which explains bash scripts

http://arachnoid.com/linux/shell_programming.html

and written this:

#!/bin/bash
for fn in *; do
  if [ "${fn#*.}" = "odt" ]
  then
     libreoffice "$fn" &
  fi  

  if [ "${fn#*.}" = "ods" ]
  then
     libreoffice "$fn" &
  fi  

done

Which does the trick.

edit flag offensive delete link more

Comments

Create a project directory and populate with your files and/or links to your files. To open them all in separate windows, move to the directory and run the command soffice *.odt *.ods (I only tested with these.) This command could be put in a script. Even shorter, soffice *.od?

w_whalley gravatar imagew_whalley ( 2012-10-05 15:04:17 +0200 )edit

That's a much simpler solution than mine! I've also realised that I could select all the files in a file manager then double-click on them. Sometimes the simple and neat solutions are hard to see. I'm still working on a slightly more sophisticated Bash script and will post if if I get it to work.

ChrisOfBristol gravatar imageChrisOfBristol ( 2012-10-05 16:39:21 +0200 )edit

I have actually had something similar - back when I was first using Linux, I put a button on my taskbar which linked to a script which opened calendar, email and task app - which I would always use together.

mjjzf gravatar imagemjjzf ( 2012-10-08 08:57:51 +0200 )edit

Question Tools

Stats

Asked: 2012-10-05 09:39:03 +0200

Seen: 150 times

Last updated: Oct 06 '12