1. Rename multiple files in the following way:
example
Original file names : test.txt and dummy.txt
New file names : test.$(date +"%F").AAAAA<serialno_1>.BBBBBB.p and dummy.$(date +"%F").AAAAA<serialno_2>.BBBBBB.p
2. The script would run every hour where the serialno counter would continue from the count of the last run.
3. The serialno counter would reset at 00:00:00 everyday.
4. The files with the new filenames will be moved to a different location.
We have done the following implementation till now. However, I am finding it a little difficult given my limited knowledge of Linux shell scripting
Not tested though, could you please try following and let us know how it goes. Also make sure while setting this script to crontab you run it to 00:00 AM of your box time.
Also not sure what do you meant by point like files should move, question is when they should move at 12:00 AM ? or every hour ?
Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
There's a decision to take: starting the script once at midnight to run all day long sleeping most of the day or having cron start it on the quarter hour. The latter might be somewhat more dependable while the former would make the counter and date handling way easier.
If your script runs every hour, and the serialno resets at 00:00, then you can simply take the current hour as serialno.
The following is suitable for hourly crontab
This User Gave Thanks to MadeInGermany For This Post:
OS : Oracle Linux 6.8
shell : bash
As shown below, I have multiple files like below (query1-extract_aa, query1-extract_ab, query1-extract_ac, ....)
$ ls -l
total 235680
-rw-rw-r-- 1 reportusr reportusr 30M May 3 11:25 query1-extract_aa
-rw-rw-r-- 1 reportusr reportusr 30M May 3 11:25... (5 Replies)
Hey guys,
I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output)
#!/bin/bash -l
#SBATCH -p node
#SBATCH -A <projectID>
#SBATCH -n 16
#SBATCH -t 7-00:00:00
#SBATCH --mem=128GB
#SBATCH --mail-type=ALL... (1 Reply)
I have multiple files in folder which i want to rename. hence I am using the below command in my script by I get an error:
export XXX_LOG_DIR="${LOG_DIR}/${XXX_HOST}/xxx/${REPORT_DATE}"
mv $XXX_LOG_DIR/*.audit.gz $XXX_LOG_DIR/*.audit.log.gz
But I get the below error:
mv: target... (5 Replies)
Hi,
In my directory I have many files, for e.g.
file_123
file_124
file_125
file_126
file_127
Instead of renaming these files one by one, I would like to rename them at a same time using same command... they should appear like
123
124
125
126
127
What command(awk or ls or... (3 Replies)
Hi
I need to reanme the multiple file using unix script
I have multiple file
like:
sample_YYYYMMDD.xls
test new_YYYYMMDD.xls
simple_YYYYMMDD.xls
I need to rename this file
sample.xls
testnew.xls
SIMPLE.xls
thanks (8 Replies)
Hi everyone,
I'm very green in Linux.
Please help me to solve my problem.
I have thousands of files and I want to change their names.
They have naming convection: prefix_date_date+1_suffix.nc
prefix: ext-GLORY
date_date+1: 20020101_20020102
and two types of suffix: gridV_R20020130 and... (3 Replies)
Hi all, I have some files like:
pickup.0000043200.t001.t001.data
pickup.0000043200.t001.t002.data
pickup.0000043200.t002.t001.data
pickup.0000043200.t002.t002.data
pickup.0000043200.t003.t001.data
pickup.0000043200.t003.t002.data
I need to rename these files to
... (3 Replies)
I am looking for the easiest way to copy a set of files 1000 times and increment sequentially.
I want to copy these 2 files:
Scenario.1.1.ud
Scenario.1.2.ud
So that it creates the following:
Scenario.2.1.ud
Scenario.2.2.ud
Scenario.3.1.ud
Scenario.3.2.ud
..
..
Scenario.1000.1.ud... (2 Replies)
Hello,
I want to rename multiple files at a time and I don't know how to do it.
I have various ".mp3" files, like "band name - music name.mp3" and I want to remove the "band name" from all files.
Anybody knows how to do it using shell script or sed or even perl?
Thanks (7 Replies)