06-24-2003
oombera:
i couldn't get that to work. i played with it for a while with different results. i'm not sure of the use of:
mv $i `dirname $i`'/xyz'
i did this:
................
for i in `find . -name */*/*DUAL*`; do
mv $i `*/*/*DUAL* $i`'/fse'
done
................
i got error:
find bad option 1005/15sep01.images/20010915_AXIAL_DUAL_11134
find path-list predicate-list
so, i'm sure it's something i've done wrong. maybe i should clarify my task.
say i have dir "02"...
02 has dirs "1004" and "1005"
1004 has dirs "a" and "b" in it
a has dirs "123abc" and "456def"
b has dirs "124abc" and "457def"
1005 has dirs "c" and "d" in it
c has dirs "125abc" and "458def"
d has dirs "126abc" and "459def"
from the 02 directory i would like to rename all subdirs with dirnames containing the pattern *abc* to "xyz"; and all subdirs with dirnames containing the pattern *def* to "uvw"
in the end i wish to have:
02/1004/a/:
xyz uvw
02/1004/b/:
xyz uvw
02/1005/c/:
xyz uvw
02/1005/d/:
xyz uvw
_________
obviously from my error above i am using *DUAL* instead of *abc* and using fse instead of xyz. i should have explained this more completely from the beginning. me bad.
criglerj: i just saw your post after i posted this. i will try your ideas and post back. thanks
quant
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
This is what I would like to do.
1. Find all directories named "ByHost" in a specified directory
2. Rename all .plist files inside "ByHost" directories
This is the way I have been able to do it so far.
#!/bin/sh
#
# Rename ByHost files
#
# Thomas Berglund, 13.07.08
# Get the... (2 Replies)
Discussion started by: Thomas Berglund
2 Replies
2. Shell Programming and Scripting
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)
Discussion started by: inCH
12 Replies
3. Shell Programming and Scripting
Hello guys,
I was looking for a shell script that removes all the special characters from the files and the subdirectories recursively. I could not locate it any more. Dose any body have a similar script that dose that?
Thanks for the help.
AV (0 Replies)
Discussion started by: avatar_007
0 Replies
4. Shell Programming and Scripting
I can rename a file with sequential numbers from 1 to N with this script:
num=1
for file in *.dat;do
mv "$file" "$(printf "%u" $num).txt"
let num=num+1
done
The script begins with renaming a some.dat file to 1.dat.txt and goes on sequentially renaming other DAT files to... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
5. UNIX for Dummies Questions & Answers
I have a number of files in directories labeled like this:
/Data/tr_gray/tr_DTI/dti_FA.nii.gz
(the brackets here represent a range of number that the files are labeled with)
I need to rename each dti_FA.nii.gz file according to the name of the folder it resides in. For example, the file ... (3 Replies)
Discussion started by: tk0034
3 Replies
6. Shell Programming and Scripting
Hi all,
I have more than 12000 files in 46 different directories and each directory has 2 sub-directories named “dat” or “gridded”. Dat sub-directories have files with extension “jpg.dat” and gridded sub-directories have files with extension “.jpg”.
I need to... (1 Reply)
Discussion started by: AshwaniSharma09
1 Replies
7. UNIX for Dummies Questions & Answers
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)
Discussion started by: a_bahreini
4 Replies
8. Shell Programming and Scripting
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)
Discussion started by: james2009
1 Replies
9. UNIX for Beginners Questions & Answers
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
10. Shell Programming and Scripting
Hi,
Friends, i have a requirement where i need to rename my files residing in multiple sub directories and move them to one different directory along with some kind of directory indicator.
For eg:
test--is my parent directory and it has many files such as
a1.txt
a2.txt
a3.txt
... (5 Replies)
Discussion started by: gnnsprapa
5 Replies