.
Computational Biology Research Group University of Oxford
.
.
. Unix help - filenames .
. .
.
 
CBRG Home
CBRG Accounts (molbiol)
Analysis tools
Training courses
Tutorials
Unix help  - filenames  - image manipulation
Examples
Papers
Collaborative data
Presentations
Oxford-only section
FAQ: CBRG + UNIX
FAQ: Bioinformatics
Links
 
 
 

SITE MAP

Filenames

  1. Filenames
  2. Characters to avoid in filenames
  3. Renaming files
  4. Effect of renaming files on Staden package


Unix and Filenames

All of the molbiol servers are running under the Unix operating system. This means that filenames must consist of only certain characters. Some of the other characters on your keyboard are actually predefined to 'mean' things to the operating system. Other operating systems - particularly Macs and PCs may accept characters in filenames that Unix machines do not. This means that when you transfer files to molbiol from a PC or a Mac, you may need to rename them before you can actually use them. This is particularly a common problem with tracefiles originating on Macs! In particular, filenames are not allowed to have spaces inside them. Why is this important? - if you manage to use any of these special characters inside a filename you may not be able to move it, copy it, read it or even delete it).


Characters to avoid in filenames

¬ ! " £ $ % ^ & *  ( ) +  = { [ } ] : ;  @ ~ #  ? < > , | \ ` '  and any spaces


You can get round most (but not all) problem filenames by putting the filename inside double quotes every time that you refer to it. For example, this will allow you to view the contents of a file called: "my problem**file($

more "my problem**file($"

top | back



Renaming files

mv: To rename a single file, use the command mv (Move):

mv old_filename new_filename

If the a file called new_filename already exists, you will be asked whether you really want to overwrite it.

rename: In addition, we have a program called rename which will let you change every occurance of one character or pattern in a filename into another character or pattern. This will work on many files at once (very useful if you have a batch of 200 tracefiles to rename all at once).
This can be used to change file-endings from 'endingOne' to 'endingTwo' using:

rename "s/endingOne$/endingTwo/"  *.endingOne

In the following example, all the file endings '.tfa' will be changed to '.fasta'

rename "s/tfa$/fasta/"   *.tfa

Note the dollar sign above ($) which tells rename that the pattern you are interested in is at the end of the filename. You can of course change any character or pattern, not just file-endings - simply remove the $.

For example, imagine you have 2 files actually called:

mouse_trans*.seq
mouse_trans2.seq

and you want to rename them by replacing the 'trans&' characters with 'tscpt', you could type:

rename "s/trans\&/tscpt/" *

Leave the \ symbol where it is - it is telling the script to ignore the special meaning of the next character (in this example: *).
Beware though - any other files in the same directory with the characters 'trans*' (for example: 'human_trans&.fasta'), will also be altered.

top | back



Effect of renaming files on Staden package

Please note that the Staden package has the ability to read the filenames that are internally stored within chromatogram files (ABI or tracefiles). If you rename such files you will need to specifically tell Pregap4 to name the new .scf and .exp files it makes using the new name of the tracefile, rather than by reading the internally stored original name (including all those nasty characters that you were trying to avoid using). This option is set at the folowing screen, where both check boxes on the right should be set to 'no'.


Staden file renaming options

top | back



Search CBRG web site:

CBRG support

This file last modified Wednesday February 22, 2006