Assuming the file names are all the same as you've indicated, this should work:
Code:
#!/usr/bin/env ksh
# big assumption that this find returns only the files you want to move
# test it first!!!
find /Data -name "*gz" | while read x
do
n="${x%%_*}" # dig number after tr and before first _
n="${n#*tr}"
fn=${x%/*}/${n}_${x##*/} # add number to build final pathname
echo "mv $x $fn" # remove the echo and quotes to actually rename files
done
Always a good idea to run this kind of script and make sure that the commands generated look good to prevent data loss. Also doesn't hurt to back things up first!
i have hundreds of directories that have to be renamed. the directory structure is fairly uniform which makes the scripting a little simpler.
suppose i have many directories like this */*/*/*abc* (in other words i have similar directory names 3 dirs deep that all contain the pattern abc in... (8 Replies)
Hi,
I'm not very experienced in shell scripting and that's probably why I came across the following problem:
I do have several hundred pairs of text files (PF00x.spl and PF00x.shd) where the first file (PF00x.spl) needs to be renamed according a string that is included in the second file... (12 Replies)
Hi,
I have around 100 xml file in a directory. I need to rename the files from .xml to .xml1. So i tried using the following command:
mv *.xml *.xml1
but i am getting the following error
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more... (8 Replies)
Dear friends,
I have created a script to rename all files in a directory by appending the file name with username (who created the file), the date it was created. For example, "apple.doc" should be renamed to "johnFeb23apple.doc" where "john" is the owner and "Feb23" is file created date. It... (4 Replies)
I have a directory e2e_ms_xfer/cent01
this contains the multiple files some of which will be named below with unique date time stamps
e2e_ms_edd_nom_CCYYMMDD_HHMM.csv
What I want to do is in a loop
1) Get the oldest file
2) Rename
3) Move it up one level from e2e_ms_xfer/cent01 to... (1 Reply)
Hi All,
I am creating a script which will connect to remote server with ssh and perfom below.
- Search in a directory
- Search for a pattern
- Check the size if greater than the size_limit rename the file.
Below is the code i have written.
ssh user@host <<EOF
find /tmp... (5 Replies)
Hi,
I have a directory with a lot of files like this:
a.bam
b.bam
c.bam
I like to rename these files based on a list where the name of the files in the first column will be replasced by the names in the second column. Here is my list which is a tab-delimited text file:
a x
b y
c ... (4 Replies)
Hello, I have a text file "file.list" with the contents below.
file1
filename1
file2
filename2
file3
filename3
file1, file2 and file3 are files existing in the same directory as the text file file.list.
I want to rename file1 to filename1, file2 to filename2, as show in the text... (1 Reply)
Hello!
New here although not completely new to Unix.
I wonder how I could rename files based on the data found in a simple textfile.
It goes like this:
I have 4 files
1 ldfgkkfjslkdfjsldkfjsf.wav
2 nndsdflksdjf.wav
3 sdflksjdf jjsdflsdfl.wav
4 dkadsdddd.wav
Textfile.txt looks like... (14 Replies)
Discussion started by: Oortone
14 Replies
LEARN ABOUT DEBIAN
mcverter
MCVERTER(1) User Commands MCVERTER(1)NAME
mcverter - non-interactive MRI conversion software
SYNOPSIS
mcverter -o <str> -f <str> [-x] [-d] [-a] [-n] [-b] [-u] [-s <num>] [-m <str>] [-F <str>] [-r] [-v] [-i] [-h] Input directory or file(s)...
DESCRIPTION -o, --output=<str>
Output directory for converted files
-f, --format=<str>
Output format: fsl, spm, meta, nifti, analyze, or bv
-x Save each series to a separate directory
-d Save output volumes as 4D files
-a Save header only (metaimage only)
-n, --nii
Save files as .nii (nifti/fsl only)
-b, --v16
Save .v16 files (BrainVoyager only)
-u Use patient id instead of patient name for output file
-s, --skip=<num>
Skip first n volumes
-m, --match=<str>
Only convert files whose series descriptions include this string
-F, --fnformat=<str>
Use this format for name of output file: +/- PatientName, PatientId, SeriesDate, SeriesTime, StudyId, StudyDescription, SeriesNum-
ber, SequenceName, ProtocolName, SeriesDescription
-r, --rescale
Apply rescale slope and intercept to data
-v, --verbose
Verbose mode
-i, --version
Version info
-h, --help
Display help
SEE ALSO
The full documentation for mcverter is maintained as a Texinfo manual. If the info and mcverter programs are properly installed at your
site, the command
info mcverter
should give you access to the complete manual.
mcverter 2.0.235 March 2012 MCVERTER(1)