Results 1 to 2 of 2
Hello everyone,
I am very new to Linux (using opensuse 10.2) and don't really know much, so if my question seems silly, I apologise.
I need to write a script ...
- 06-28-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 1
script file for renaming
Hello everyone,
I am very new to Linux (using opensuse 10.2) and don't really know much, so if my question seems silly, I apologise.
I need to write a script file that renames files for me. I know how to do it one-by-one, but I have over 2000 to rename, and was told I can write a script file to do so.
To help you out, I will describe my layout.
I have 15 folders named f1 to f15.
In each folder I have another folder called MCCDAnalysis.
In each MCCDAnalysis folder I have the following files
FFTPlans.Wisdom.dat untrippedn-1.0027.plt untrippedn-1.0055.plt
untrippedn-1.0001.dpiv untrippedn-1.0029.dpiv untrippedn-1.0057.dpiv
untrippedn-1.0001.plt untrippedn-1.0029.plt untrippedn-1.0057.plt
untrippedn-1.0003.dpiv untrippedn-1.0031.dpiv untrippedn-1.0059.dpiv
untrippedn-1.0003.plt untrippedn-1.0031.plt untrippedn-1.0059.plt
untrippedn-1.0005.dpiv untrippedn-1.0033.dpiv untrippedn-1.0061.dpiv
untrippedn-1.0005.plt untrippedn-1.0033.plt untrippedn-1.0061.plt
untrippedn-1.0007.dpiv untrippedn-1.0035.dpiv untrippedn-1.0063.dpiv
untrippedn-1.0007.plt untrippedn-1.0035.plt untrippedn-1.0063.plt
untrippedn-1.0009.dpiv untrippedn-1.0037.dpiv untrippedn-1.0065.dpiv
untrippedn-1.0009.plt untrippedn-1.0037.plt untrippedn-1.0065.plt
untrippedn-1.0011.dpiv untrippedn-1.0039.dpiv untrippedn-1.0067.dpiv
untrippedn-1.0011.plt untrippedn-1.0039.plt untrippedn-1.0067.plt
untrippedn-1.0013.dpiv untrippedn-1.0041.dpiv untrippedn-1.0069.dpiv
untrippedn-1.0013.plt untrippedn-1.0041.plt untrippedn-1.0069.plt
untrippedn-1.0015.dpiv untrippedn-1.0043.dpiv untrippedn-1.0071.dpiv
untrippedn-1.0015.plt untrippedn-1.0043.plt untrippedn-1.0071.plt
untrippedn-1.0017.dpiv untrippedn-1.0045.dpiv untrippedn-1.0073.dpiv
untrippedn-1.0017.plt untrippedn-1.0045.plt untrippedn-1.0073.plt
untrippedn-1.0019.dpiv untrippedn-1.0047.dpiv untrippedn-1.0075.dpiv
untrippedn-1.0019.plt untrippedn-1.0047.plt untrippedn-1.0075.plt
untrippedn-1.0021.dpiv untrippedn-1.0049.dpiv untrippedn-1.0077.dpiv
untrippedn-1.0021.plt untrippedn-1.0049.plt untrippedn-1.0077.plt
untrippedn-1.0023.dpiv untrippedn-1.0051.dpiv untrippedn-1.0079.dpiv
untrippedn-1.0023.plt untrippedn-1.0051.plt untrippedn-1.0079.plt
untrippedn-1.0025.dpiv untrippedn-1.0053.dpiv vector.in
untrippedn-1.0025.plt untrippedn-1.0053.plt
untrippedn-1.0027.dpiv untrippedn-1.0055.dpiv
The first folder f1>MCCDAnalysis is fine. The files go from untrippedn-1.0001 to
untrippedn-1.0079 in odd increments 1, 3, 5 and so on.
The problem I have is that the rest of the flders f2 up to f15 also have files untrippedn-1.0001 to untrippedn-1.0079 in odd increments 1, 3, 5 and so on.
What I need to do is ensure the numbering follows on from folder f1 to folder f2 by odd increments.
For example, folder f1 ends with untrippedn-1.0079, and folder f2 starts with untrippedn-1.0001. I need a script file that renames all the files in folder f2 from untrippedn-1.0001 until untrippedn-1.0079 to untrippedn-1.0081 until untrippedn-1.0119, and folder f3 to start with untrippedn-1.0121 and end with untrippedn-1.0159 and so on....
Is this confusing?
Basically, I just need a generic script file that renames the files untrippedn-1.0001 to another number at the end... i.e untrippedn-1.0081
Any help would be really appreciated
- 06-28-2007 #2
This is a good place for you to start
LinuxCommand.org: Learn the Linux command line. Write shell scripts.


Reply With Quote