Sponsored Content
Top Forums Shell Programming and Scripting Renaming bulk directories and subfiles Post 302859761 by Diya123 on Thursday 3rd of October 2013 06:57:09 PM
Old 10-03-2013
Renaming bulk directories and subfiles

Hi,

I have a directory with 100 subdirectories and each of these subdirectories has 1 file. Now I have to rename all these.

The structure is "files directory has 100 SRR191639-SRR191718 subfolders and in each there is a file with the same name a subdirectory followed by .sra extension (SRR191639.sra)

example files->SRR191639->SRR191639.sra

Like this I have 100 files

I have a another file which has the sample names corresponding to these SRR numbers. Now I want to rename the subdirectories and the file in those directories with the sample names.

Sample name file:
Code:
ABC_123 SRR191639
XYZ_IRT SRR191640
ABC_1LK SRR191641

output

The subdirectories and the child files should be renamed to

Code:
ABC_123->ABC_123.sra
XYZ_IRT->XYZ_IRT.sra
ABC_1LK->ABC_1LK.sra

Thanks,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

outcomment bulk

Hello chiefs, So i wanna outcomment several lines, but i dont want to start each line with #-sign. Once i saw it in use, but dont remember the syntax. It should work with sh or ksh. regards congo (3 Replies)
Discussion started by: congo
3 Replies

2. Shell Programming and Scripting

Need help renaming bulk file extentions

Hello, I am trying to rename bulk files however i dont think the rename/mv command is giong to help me here. here is a quick snapshot of the files I need to rename: 75008040 -rw-r----- 1 root root 8716 May 8 05:00 10.9.144.2 75008041 -rw-r----- 1 root root 11700 May 8 05:00 10.9.160.2... (10 Replies)
Discussion started by: jallan
10 Replies

3. UNIX for Dummies Questions & Answers

Batch Renaming: Change files' extensions in many sub-directories

Hi all - I'm trying to rename a large number of files all at once and need some help figuring out the command line syntax to do it. I've already done quite a bit of research with the rename and mv commands, but so far haven't found a solution that seems to work for me. So: The files exist... (10 Replies)
Discussion started by: dave920
10 Replies

4. UNIX for Dummies Questions & Answers

Renaming files after their directory name in multiple sub directories

So I am not sure if this should go in the shell forum or in the beginners. It is my first time posting on these forums. I have a directory, main_dir lets say, with multiple sub directories (one_dir through onehundred_dir for example) and in each sub directory there is a test.txt. How would one... (2 Replies)
Discussion started by: robotsbite
2 Replies

5. UNIX for Dummies Questions & Answers

Moving files out of multiple directories and renaming them in numerical order

Hi, I have 500 directories each with multiple data files inside them. The names are sort of random. For example, one directory has files named e_1.dat, e_5.dat, e_8.dat, etc. I need to move the files to a single directory and rename them all in numerical order, from 1.dat to 1000(or some... (1 Reply)
Discussion started by: renthead720
1 Replies

6. Shell Programming and Scripting

renaming directories with shell script

Hi All after looking around the website and various other resources I become stuck. I'm trying to rename directories from Firstname Initial Lastname to lastname,_firstname_initial so far ive got for f in {./} do rename -n 'y/A-Z/a-z/' * rename -n 's/\ /_/g' * ... (2 Replies)
Discussion started by: harlequin
2 Replies

7. Shell Programming and Scripting

bulk renaming of files in sftp using script

Hi, Am using sftp (dsa method) to transfer 20 files from one server(sftp) to another (local). After the transfer is complete the files in the sftp server has to be renamed from .txt extension to .done extension ( aa.txt to aa.done, bb.txt to bb.done and likewise...). I tried rename command... (4 Replies)
Discussion started by: Sindhuap
4 Replies

8. Shell Programming and Scripting

Renaming files in bulk.

Hi, I have a bunch of files which are named something like: Company Name~1234~X1234~X1-123.pdf I need to get them renamed something like: Company Name~1234(X1234)X1-123.pdf Once I have the X1234 inside () I have a piece of software which can use the X1234 bit. I will be receiving... (7 Replies)
Discussion started by: jcborland
7 Replies

9. Shell Programming and Scripting

Renaming files in multiple directories

Hi I have the following file structure and I want to rename all the abc.jar files to abc_backup.jar rock@server:~/rakesh> ls -R .: test1 test2 test3 ./test1: abc.jar ./test2: abc.jar ./test3: abc.jar (2 Replies)
Discussion started by: rakeshkumar
2 Replies

10. Shell Programming and Scripting

Renaming directories stops resumption of write process

so lets say I have a process in cron that writes to a particular directory /var/tmp/EXAMPLEA so, from time to time, say every couple of months, an upgrade is made. and here's how the upgrade works: 1. move the existing directory /var/tmp/EXAMPLEA somewhere else and name it differently...i.e.... (6 Replies)
Discussion started by: SkySmart
6 Replies
XIntersectRegion(3X11)						     MIT X11R4						    XIntersectRegion(3X11)

Name
       XIntersectRegion, XUnionRegion, XUnionRectWithRegion, XSubtractRegion, XXorRegion, XOffsetRegion, XShrinkRegion - region arthmetic

Syntax
       XIntersectRegion(sra, srb, dr_return)
	  Region sra, srb, dr_return;

       XUnionRegion(sra, srb, dr_return)
	  Region sra, srb, dr_return;

       XUnionRectWithRegion(rectangle, src_region, dest_region_return)
	  XRectangle *rectangle;
	  Region src_region;
	  Region dest_region_return;

       XSubtractRegion(sra, srb, dr_return)
	  Region sra, srb, dr_return;

       XXorRegion(sra, srb, dr_return)
	  Region sra, srb, dr_return;

       XOffsetRegion(r, dx, dy)
	  Region r;
	  int dx, dy;

       XShrinkRegion(r, dx, dy)
	  Region r;
	  int dx, dy;

Arguments
       dest_region_return
		 Returns the destination region.

       dr_return Returns the result of the computation.  ds Dy move or shrink

       dx
       dy	 Specify the x and y coordinates, which define the amount you want to  the specified region.

       r	 Specifies the region.

       rectangle Specifies the rectangle.

       sra
       srb	 Specify the two regions with which you want to perform the computation.

       src_region
		 Specifies the source region to be used.

Description
       The function computes the intersection of two regions.

       The function computes the union of two regions.

       The function updates the destination region from a union of the specified rectangle and the specified source region.

       The function subtracts srb from sra and stores the results in dr_return.

       The function calculates the difference between the union and intersection of two regions.

       The function moves the specified region by a specified amount.

       The function reduces the specified region by a specified amount.  Positive values shrink the size of the region, and negative values expand
       the region.

See Also
       XCreateRegion(3X11), XDrawRectangle(3X11), XEmptyRegion(3X11)
       X Window System: The Complete Reference, Second Edition, Robert W. Scheifler and James Gettys

															    XIntersectRegion(3X11)
All times are GMT -4. The time now is 02:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy