Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Change All File Names in a Directory Post 302160125 by Ygor on Monday 21st of January 2008 12:28:28 AM
Old 01-21-2008
Try...
Code:
c=0
for i in *
do 
   test -f $i &&\
   mv $i $(printf "FILE%03i" $c) &&\
   ((c+=1))
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to change automatically the file names

Hi all, I need to replace automatically all special characters of one filename with some corresponding characters For example > ö --> oe ä --> ae .... If the special character comes more than one time, then all the coccuerences have to be replaced. I would like to have a... (6 Replies)
Discussion started by: MAKY
6 Replies

2. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

3. Shell Programming and Scripting

Change multiple file names

Hello, I have some files in a directory like: 01_07_2010_aa.txt 01_07_2010_bb.txt 01_07_2010_cc.txt 01_07_2010_dd.txt 01_07_2010_ee.txt 01_07_2010_ff.txt I want to change their names to : 3nm_aa.txt 3nm_bb.txt 3nm_cc.txt 3nm_dd.txt 3nm_ee.txt 3nm_ff.txt (8 Replies)
Discussion started by: ad23
8 Replies

4. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

5. Shell Programming and Scripting

change multiple file names

Hi is it possible to change multiple files (~10k) names with out disturbing the data in it. ? input Hynda|cgr10(+):100027702-1000312480|.txt Hynda|cgr10(+):100027702-1000312483|.txt Hynda|cgr10(+):100027702-1000312484|.txt Hynda|cgr10(+):100027702-1000312482|.txt output... (4 Replies)
Discussion started by: quincyjones
4 Replies

6. Red Hat

How to change name to get rid of name in front of file names?

admin.campaign.sql admin.cardnumber_filter.sql understand that rename is using mv command but how do I rename such that it become the following: campaign.sql cardnumber_filter.sql thanks (2 Replies)
Discussion started by: jediwannabe
2 Replies

7. UNIX for Dummies Questions & Answers

Change sequence names in fasta file

I have fasta files with multiple sequences in each. I need to change the sequence name headers from: >accD:_59176-60699 ATGGAAAAGTGGAGGATTTATTCGTTTCAGAAGGAGTTCGAACGCA >atpA_(reverse_strand):_showing_revcomp_of_10525-12048 ATGGTAACCATTCAAGCCGACGAAATTAGTAATCTTATCCGGGAAC... (2 Replies)
Discussion started by: tyrianthinae
2 Replies

8. Shell Programming and Scripting

Challenge to change file names

Hi, How can I change following file name in a bash script? From file names: myfile-module-1.0-3.0.el6.x86_64.package To file names: myfile-module1_0-1.0-3.0.el6.x86_64.package ^ ^ ^ ^ ^ ^ ^ ^ Basically, the digit 1.0 is a version number, the digit 3.0 is... (11 Replies)
Discussion started by: hce
11 Replies

9. Shell Programming and Scripting

Change the file name and copy old file content to new file names.

Hi, I have a files in a directory as below :- ls -1 mqdepth-S1STC02 proc-mq-S1STC01 proc-mq-S1STC02 proc-mq-S1STC03 Whereever i have S1STC i need to copy them into new file with file name S2STC. expected output :- ls -1 mqdepth-S2STC02 proc-mq-S2STC01 proc-mq-S2STC02... (3 Replies)
Discussion started by: satishmallidi
3 Replies

10. Shell Programming and Scripting

Script to change file names

I have a landing directory on my unix (solaris) server, that receives the following files: MLH4301I AAOT-hhslog.610.20150805.txt MLH4301I AAOT-hhslog.611.20150805.txt MLH4301I AAOT-hhslog.612.20150805.txt MLH4301I AAOT-hhslog.613.20150805.txt and I need to add to this files the number 10000... (6 Replies)
Discussion started by: fretagi
6 Replies
CosFileTransfer_FileTransferSession(3erl)		     Erlang Module Definition			 CosFileTransfer_FileTransferSession(3erl)

NAME
CosFileTransfer_FileTransferSession - This module implements the OMG CosFileTransfer::FileTransferSession interface. DESCRIPTION
To get access to the record definitions for the structures use: -include_lib("cosFileTransfer/include/*.hrl"). EXPORTS
'_get_protocols_supported'(FTS) -> Return Types FTS = #objref Return = [#'CosFileTransfer_ProtocolSupport'{protocol_name=Type, addresses=[Address]}] Type = Address = string() This read only attribute returns the protocols supported by the target object. set_directory(FTS, Directory) -> Return Types FTS = Directory = #objref Return = ok | {'EXCEPTION, E} Invoking this operation will change the current working directory of the target object's associated file system. If fail to do so the appropriate exception is raised. create_file(FTS, FileNameList) -> Return Types FTS = #objref FileNameList = [string()] Return = File | {'EXCEPTION, E} File = #objref This operation creates a File Object representing a file which may or may not exist. For this operation to be independent of the working directory the supplied FileNameList must represent the absolute name. create_directory(FTS, FileNameList) -> Return Types FTS = #objref FileNameList = [string()] Return = Directory | {'EXCEPTION, E} Directory = #objref This operation creates a new directory in the target objects associated file systems domain. If fail to do so an exception is raised but, if successful, a Directory object representing the new directory is returned. get_file(FTS, FileNameList) -> Return Types FTS = #objref FileNameList = [string()] Return = FileWrapper | {'EXCEPTION, E} FileWrapper = #'CosFileTransfer_FileWrapper'{the_file = File file_type = Type} File = #objref Type = nfile | ndirectory This operation, creates a FileWrapper which represents a file or directory, and should be independent of the working Directory, i.e., a full path name must be supplied. Furthermore, the file or directory represented by the FileNameList must exist. delete(FTS, File) -> Return Types FTS = File = #objref Return = ok | {'EXCEPTION', E} This operation removes the file or directory, represented by the File object, from the target objects associated file system. If it is a non-empty directory or non-existing file or directory an exception is raised. transfer(FTS, SourceFile, DestinationFile) -> Return Types FTS = SourceFile = DestinationFile = #objref Return = ok | {'EXCEPTION', E} If the target object's and the DestinationFile's associated FileTransferSession's support the same protocol(s) this operation will copy the file represented by the SourceFile from the target object's file system to a file in the destination FileTransferSession's file system. The file is represented by the DestinationFile object and may not exist. This operation must be invoked on the File- TransferSession associated with the SourceFile object. append(FTS, SourceFile, DestinationFile) -> Return Types FTS = SourceFile = DestinationFile = #objref Return = ok | {'EXCEPTION', E} This operation behaves almost like the transfer/3 operation. The difference is that the DestinationFile must exist since the Source- File will be appended to the DestinationFile . Currently, it is not possible to use this operation when the target object represents FTP. insert(FTS, SourceFile, DestinationFile, Offset) -> Return Types FTS = SourceFile = DestinationFile = #objref Offset = long() Return = ok | {'EXCEPTION', E} This operation behaves almost like the append/3 operation. The difference is that the SourceFile will be inserted into the Destina- tionFile Offset bytes from the start of the file. Currently, it is not possible to use this operation when the target object represents FTP. logout(FTS) -> ok Types FTS = #objref This operation terminates the target object and closes the connection to the file system it represents. Ericsson AB cosFileTransfer 1.1.10 CosFileTransfer_FileTransferSession(3erl)
All times are GMT -4. The time now is 05:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy