Hi guys,
These command lines are interesting, but you can use a small software
that do the job for you: rnameit
However, I think it only works under windows...
Laurent.
On 31 mai, 14:59, Tom Schoenemann <
tom.schoenem...@gmail.com> wrote:
> A simple shell script can also change the file extensions (or add file extensions). You can easily add ".dcm" (or whatever extension you want) to all the files in a directory using the command line by doing:
>
> for i in $( ls * ); do mv $i $i.dcm ;done
>
> If you are paranoid, you could make copies of the files, leaving the original ones untouched, by doing:
>
> for i in $( ls * ); do cp $i $i.dcm ;done
>
> If you have the utility "sed" in your command line (comes with Mac OS X and Linux, but not sure about Windows), you can also easily change the extension from one thing (e.g., ".DICOM" to another (".dcm") for every file in a directory.
>
> lets say you want to change all files like:
> blah.DICOM
> to look like:
> blah.dcm
>
> do this:
> for i in $(ls *.DICOM | sed 's/.DICOM//' ); do mv $i.DICOM $i.dcm ;done
>
> [explanation of how the shell command works, for those interested:
>
> "for i in $( [something here] )" goes through (or does) whatever is in "[something here]", assigning each instance of "something here" to the variable "i", one at a time
>
> "ls *.DICOM" lists all files in a directory ending in ".DICOM"
>
> "|" (a "pipe") sends the output of whatever came before (in this case, a listing of all the files ending in ".DICOM") to a new command (in this case, the "sed" command)
>
> " sed 's/.DICOM//' " removes the ".DICOM" from the name of each instance that the "ls" command found. Note that it does this in the scripts list, internally, only -- it doesn't change the actual name of the file on your disk.
>
> " do mv $i.DICOM $i.dcm " takes each "i" (determined in the "for i in $...." step above), looks for a filename corresponding to $i.DICOM, and renames it with "mv" to $i.dcm.
>
> This "for i in $..." is great for some set of repeated actions you want to do on a set of files in a directory.
>
> Hope this is useful to someone!
>
> -Tom
>
> On May 30, 2011, at 8:41 AM,
ara.yeram...@uniklinik-freiburg.de wrote:> Hi,
> > I'm also interested in knowing this. I had the same problem some time ago, so I just wrote a small Python script to automatically assign extensions to files without ones.
> > Thanks in advance.
> > Ara Yeramian
>
> > On May 29, snapangelo writes just what I wanted to say. Thanks!
> > Now the link that I mentioned on May 25
> > (
http://www.itksnap.org/pmwiki/pmwiki.php?
> > n=Documentation.TutorialRawInput)
> > becomes active again and says "The user must specify information about
> > how data in the file is organized."
> > My file without format information is actually a DICOM file and can be
> > opened with DICOM viewers.
> > I would like to know how you read it using ITK-SNAP.
> > Thank you again in advance.
>
> > --
> > You received this message because you are subscribed to the Google Groups "itksnap-users" group.
> > To post to this group, send email to
itksna...@googlegroups.com.
> > To unsubscribe from this group, send email to
itksnap-user...@googlegroups.com.
> > For more options, visit this group athttp://
groups.google.com/group/itksnap-users?hl=en.