06-24-2003
all the dirs are "forked" off from each other. there are no directories that contain more than one directory with the same pattern (i hope that makes sense). i understand your point, and i hadn't thought of that. thanks, i'll try your suggestion and post back
thanks again
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
LEARN ABOUT REDHAT
file::spec::os2
File::Spec::OS2(3pm) Perl Programmers Reference Guide File::Spec::OS2(3pm)
canonpath
No physical check on the filesystem, but a logical cleanup of a path. On UNIX eliminated successive slashes and successive "/.".
splitpath
($volume,$directories,$file) = File::Spec->splitpath( $path );
($volume,$directories,$file) = File::Spec->splitpath( $path, $no_file );
Splits a path in to volume, directory, and filename portions. Assumes that the last file is a path unless the path ends in '/', '/.', '/..'
or $no_file is true. On Win32 this means that $no_file true makes this return ( $volume, $path, undef ).
Separators accepted are and /.
Volumes can be drive letters or UNC sharenames (\servershare).
The results can be passed to "catpath" to get back a path equivalent to (usually identical to) the original path.
splitdir
The opposite of catdir().
@dirs = File::Spec->splitdir( $directories );
$directories must be only the directory portion of the path on systems that have the concept of a volume or that have path syntax that dif-
ferentiates files from directories.
Unlike just splitting the directories on the separator, leading empty and trailing directory entries can be returned, because these are
significant on some OSs. So,
File::Spec->splitdir( "/a/b//c/" );
Yields:
( '', 'a', 'b', '', 'c', '' )
catpath
Takes volume, directory and file portions and returns an entire path. Under Unix, $volume is ignored, and this is just like cat-
file(). On other OSs, the $volume become significant.
NAME
File::Spec::OS2 - methods for OS/2 file specs
SYNOPSIS
require File::Spec::OS2; # Done internally by File::Spec if needed
DESCRIPTION
See File::Spec::Unix for a documentation of the methods provided there. This package overrides the implementation of these methods, not the
semantics.
perl v5.8.0 2002-06-01 File::Spec::OS2(3pm)