I have the following directories under "0.0.0.0"
And Here is my requirement, please help me to write a shell script i.e.
from the above list, i want to rename directory 621 to tested-621 and the shell script should KEEP (dont not delete) builds 620, tested-621 and 622 and delete rest of the directories before 620 and after 621 (tested-621). Please note, I want to keep all the directories that are starting with tested-xxxx
Could you please help?
---------- Post updated at 12:47 PM ---------- Previous update was at 12:35 PM ----------
I found the following command in the forum:
But this will keep all the directories that are starting with tested* and delete rest all the directories. But, i want to keep all the tested* directories plus keep build+1 and build -1. For example, under "0.0.0.0" directory say build 50 is renamed to tested-50 then Your script should KEEP build 49, tested-50, 51.
I have a file <filestodelete> containing names of files to to be deleted from a directory <filesstore>.
I want a script file which accptes the <filestodelete> and also the location of the directory(<filestore>) and deletes all files matching.
Thanks in Advance.. (3 Replies)
Under TEMP folder, it have many sub-folder, example"0015,0016,etc"
I need to discovery those file which are 2 days ago in this sub-folder , and list out to investigate, at the end delete all file in those sub folder, only keep the emptu directory. Thanks (4 Replies)
There are some files in a directory like a.tx~ , b.txt~,c.txt~.
I want to delete all these files inside that directory and sub directory.
How can i do this?
#!/bin/bash
cd thatdirectory
......
rm -rf *~
...... (7 Replies)
Hi ,
I am trying to make a cron job to delete the contents of a directory in a linux environment.The contents created before 2 days should get deleted by this job.Here is what i have written :
/usr/bin/find / -name *.log -ctime +2 -exec /bin/rm -f {} \;
Is it correct....If not so,please... (9 Replies)
Hi, what function do we use to delete only particular file that we want in directory shell script
for example I want only to delete test.txt in directory how to do it ? in sh
Thank (1 Reply)
I need a script which should watch a directory for a file with specific directory.
If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column.
The file should be moved to another directory and the a... (8 Replies)
Hi
My directory structure is as below.
dir1, dir2, dir3
I have the list of files to be deleted in the below path as below.
/staging/retain_for_2years/Cleanup/log $ ls -lrt
total 0
drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2
drwxr-xr-x 2 root ... (2 Replies)
I have a script, which is checking if file exists and move it to another directory
if
then
mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly
mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly
... (9 Replies)