Sponsored Content
Full Discussion: randomly renaming files
Top Forums UNIX for Dummies Questions & Answers randomly renaming files Post 302315212 by platz on Monday 11th of May 2009 10:55:48 PM
Old 05-11-2009
randomly renaming files

I have a directory of files that look like filename 001.ext, filename 002.ext, etc. I'd like to rename the files with unique random numbered names, so that the original filenames are stripped and the files are given a new, random number name. I'm not super new to UNIX, but I don't often use it for this kind of scripting. I'm going to keep browsing the forums for usable code, but any suggestions you may have quickly would certainly be very appreciated. Thanks always.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

renaming files

directory name = /usr/tom/1997 files - ABC_1997_ST1_BCD.SQL BCD_1997_ST1_EFG_SAB.SQL TTT_EBC_1997_ST1_A.SQL sub directory - /usr/tom/1997/jan a) I want to just rename the all files ending with '.SQL' and also its contents in the 1997 directory(excluding subdirectories eg... (3 Replies)
Discussion started by: systemsb
3 Replies

2. AIX

Randomly appearing control characters in text files

Hi, From some time, we have noticed that our ascii files have started corrupting due to the presence of some random control characters (^@, ^M, ^H, ^D). The characters appear randomly on any file after the process that creates the file finishes. If we rerun the process, the files re creates... (0 Replies)
Discussion started by: aakashahuja
0 Replies

3. Shell Programming and Scripting

Renaming files

hi, I have the following files as below. reg_test_123232 reg_test_125654 reg_test_473843 How do I rename reg_test_123232 to abc_123232 and the rest of file by just keeping the numeric field ? Please advise :) (3 Replies)
Discussion started by: cedrichiu
3 Replies

4. UNIX for Dummies Questions & Answers

Renaming files

Hello! I am not familiar with UNIX and I have this problem: I need to move files from a UNIX machine to a PC. UNIX file names contain ":" as special character which is not recognized in a PC. How can I change ":" for "_" in the name of a bunch of files in UNIX? Thanks for your help. (7 Replies)
Discussion started by: Tygoon
7 Replies

5. Shell Programming and Scripting

renaming files

Hello, I wanted to rename one file where filename contains space.. How can i rename in unix? The file name is ABC XYZ.TXT I wanted to rename this file as ABCXYZ.TXT. Any help is greatly appreciated... Regards. (4 Replies)
Discussion started by: govindts
4 Replies

6. Shell Programming and Scripting

renaming files or adding a name in the beginning of all files in a folder

Hi All I have a folder that contains hundreds of file with a names 3.msa 4.msa 21.msa 6.msa 345.msa 456.msa 98.msa ... ... ... I need rename each of this file by adding "core_" in the begiining of each file such as core_3.msa core_4.msa core_21.msa (4 Replies)
Discussion started by: Lucky Ali
4 Replies

7. Shell Programming and Scripting

randomly shuffle two text files the same way

What I have are two text files that I need to shuffle randomly, but I need the two files to be randomly shuffled the same way. I have heard of shuf but I do not know how to use it for two files. Maybe there is also an easy/simple awk command I do not know about that could handle this problem. ... (3 Replies)
Discussion started by: adrunknarwhal
3 Replies

8. Shell Programming and Scripting

Randomly selecting sequences and generating specific output files

I have two files containing hundreds of different sequences with the same Identifiers (ID-001, ID-002, etc.,), something like this: Infile1: ID-001 ATGGGAGCGGGGGCGTCTGCCTTGAGGGGAGAGAAGCTAGATACA ID-002 ATGGGAGCGGGGGCGTCTGTTTTGAGGGGAGAGAAGCTAGATACA ID-003... (18 Replies)
Discussion started by: Xterra
18 Replies

9. UNIX for Dummies Questions & Answers

Help with renaming the files.

Hi, I have 31 file as below.... dt_ref_med_merged_madt_h_19980101.nc .. .. dt_ref_med_merged_madt_h_19980131.nc I want to rename it like... dt_ref_med_merged_madt_h_1998_1.nc .. .. dt_ref_med_merged_madt_h_1998_31.nc How can I do it ? any suggestions ? I want to do it small... (5 Replies)
Discussion started by: mahesh shinde
5 Replies

10. Shell Programming and Scripting

Renaming multiple files in sftp server in a get files script

Hi, In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this? I am using #!/bin/ksh For eg: sftp user@host <<EOF cd /path get *.txt rename *.txt *.txt.done ... (7 Replies)
Discussion started by: jhilmil
7 Replies
VSTP(1) 						       BrlNet User's Manual							   VSTP(1)

NAME
vstpg, vstpp - VisioBraille file transferring SYNOPSIS
vstpg [-ifbnd] [-s socketport] [-k keyname] [-o configname] file ... DESCRIPTION
vstpg (resp. vstpp) gets (resp. puts) files from (resp. onto) a VisioBraille terminal. For communicating with the terminal, you must launch brltty with the BrlNet driver, and telling BrlNet to use the VisioBraille driver. Before putting on the terminal, file names are truncated to 8 characters without any extension. Before getting from terminal, leading path and trailing extensions are removed, but put back for local filename. COMMAND-LINE OPTIONS -i ask for confirmation of transfer, for each file (on the terminal) -f don't ask for such a confirmation (default) -b if they exists, recursively rename the old files with an added .x suffix, just like logrotate does -n do not keep such backup file (default) -s socketport use socketport as the port number instead of default for connecting to BrlNet -k filename use filename as key path instead of default for reading BrlNet's authentication key -d use current directory rather than the download directory (see vbs_dir below) -o filename also read filename as config file CONFIG FILE
vstpg and vstpp read a configuration file $HOME/.vstprc which contains keywords or equalities, one per line (what follows a # is ignored). You can ask them to also read any other file thanks to the -o option. Here are keywords: backup make -b option the default nobackup make -f option the default and equalities: keyname = filename use this file instead of default, to find BrlNet's authentication key socketport = port use this port number, instead of default, to connect to BrlNet vbs_ext = .ext use .ext as an extension for downloaded files (.vis by default) this is overriden on command line if an extension is provided in the file name vbs_dir = path use path instead of current directory for putting files, except when using the -d option, or if the filename begins with '.' RETURNED VALUE
1 syntax error on command line 2 connection with BrlNet error 3 Unix file error 4 Protocol error 16 interrupted by user SHELL EXPANSIONS
Beware of special chars: * and . are often expanded by your shell, hence vstpp * will probably do what you want, putting every file exist- ing in the current directory onto the terminal, but vstpg * may not do what you want: it will only get every file which already exist in the current directory, skipping those you just created on your terminal ! If you want to get every file which exist in the terminal, you should use vstpg '*' or something similar (please read your shell manual). The same warning applies to other special chars, such as $, ~, &,... which should be protected by surrounding arguments by quotes (') or by using single backslashes () just before them (please read your shell manual). BUGS
The one we could find has been corrected :) AUTHOR
Samuel Thibault <samuel.thibault@ens-lyon.org> and Sebastien Hinderer <sebastien.hinderer@ens-lyon.fr> BrlNet Jul 15, 2002 VSTP(1)
All times are GMT -4. The time now is 01:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy