Sponsored Content
Top Forums UNIX for Beginners Questions & Answers List Files being deleted in a shell script Post 302991538 by alexcol on Monday 13th of February 2017 05:06:19 AM
Old 02-13-2017
Thank you very much for your support

First the enviroment is:


Code:
[pmba1@PRODPMBA3 shell]$ uname -s
Linux
[pmba1@PRODPMBA3 shell]$ uname -a
Linux PRODPMBA3 2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64 x86_64 x86_64 GNU/Linux



2nd How did i get the list of 500,000 files to be removed?

grepping into a backup file (bplist)
Code:
grep  AB_restat_2015  home_Informe_Bplist-PRODPMBA3_15012017_Q626996.txt | grep log | grep 
'/home/pmba1/shell'

--Ouput
Code:
rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-22-01.log.gz
-rw-r--r-- pmba1     pmba1             136 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-23-01.log.gz
-rw-r--r-- pmba1     pmba1             138 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-24-02.log.gz
-rw-r--r-- pmba1     pmba1             139 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-25-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-26-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-27-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-28-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-29-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-30-01.log.gz
-rw-r--r-- root      root              138 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-30-02.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-31-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-32-01.log.gz
-rw-r--r-- pmba1     pmba1             136 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-33-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-34-01.log.gz
-rw-r--r-- pmba1     pmba1             140 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-35-02.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-36-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-37-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-38-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-39-01.log.gz
-rw-r--r-- pmba1     pmba1             140 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-40-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-41-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-42-01.log.gz
-rw-r--r-- pmba1     pmba1             136 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-43-01.log.gz
-rw-r--r-- pmba1     pmba1             137 Jan 15 00:25 /home/pmba1/shell/AB_restat_2015-01-03-01-44-01.log.gz


then construct the script extracting the names of files found in bplist, using vi editor and adding the rm command for each file name

Thanks for your help in advanced
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pulling a list of files from FTP site in a shell script

Hi, I am writting a shell script which will pull a list files (mentioned in one file 1.txt) from external FTP site (for ex: ftp://abcd.efghijk.com/). The 1.txt is in my local unix directory. I have username and password to connect the external FTP site. Also before I pull the files, I need... (0 Replies)
Discussion started by: spatra
0 Replies

2. Shell Programming and Scripting

Getting a list of files on an ftp, via shell script...

G'day, I was wanting to write a shell script that checks an ftp server for the presence of new files, then get those files. In so much as the get, this is pretty straight forward, but I cannot work out how to get a list of files to check. Is it possible for a shell script to get the output of... (1 Reply)
Discussion started by: Elric of Grans
1 Replies

3. Shell Programming and Scripting

Shell Script Create List of Deleted Files

Hi, I want to put all the deleted files in a txt file. Because i want to backup my image server which has thousands of jpg images. I wrote a shell script which will copies images from image server to backup image server. I setup a cronjob which runs on every five minutes. & through timestamp it... (8 Replies)
Discussion started by: mirfan
8 Replies

4. Shell Programming and Scripting

Shell Script Needed to Read a text from a list files

Hi, Below is my issue which I desperately need and I want a shell script which can do this job. I need this script as I m planning to put this for a system health check. Please assist me. 1. There are 10 log files in a particular location. 2. open each log file. Goto to the end of the... (4 Replies)
Discussion started by: kashriram
4 Replies

5. AIX

Who deleted my files

Just looking for some guidance on how to figure out who might have deleted some files off one of my systems. These files are not root owned files so could be deleted by a handful of folks in the group responsible for these files besides the root users. Anyway I have been tasked with trying to... (1 Reply)
Discussion started by: juredd1
1 Replies

6. UNIX for Dummies Questions & Answers

Generate list of deleted files

I copied all JPEGs from my laptop to an external drive using find . -name "*.jpg" -exec cp '{}' ./media/Backup/pictures \; And then deleted all of them from my laptop. Now, I realize that I need the folder path of all the original JPEGs as the path has the important information. I dont... (1 Reply)
Discussion started by: eshwaconsulting
1 Replies

7. Shell Programming and Scripting

Urgent...Need a shell script to list files which belong to particular groups

Hi, I am just new to scripting but got to write a complex scipt please help. i need a shell script which can check the list of data listed in a txt doc and see if they belong to any of the groups that are listed in other list file.... (5 Replies)
Discussion started by: draghun9
5 Replies

8. Shell Programming and Scripting

Need help in finding and copying list of files using bash shell script

Dear All, I have a situation where I want to copy some files of type .txt. These files are o/p from one program. Some of the files are named as fileName .txt instead of fileName.txt after fileName by mistake I have specified "space". Now I want to move these files as follows. mv fileName*... (13 Replies)
Discussion started by: linuxUser_
13 Replies

9. UNIX for Advanced & Expert Users

Help with a shell script? List files, delete them and log them

Hello, i'm trying to solve this script. List, one at a time, all files larger than 100K in the /home/username directory tree. Give the user the option to delete or compress the file, then proceed to show the next one. Write to a logfile the names of all deleted files and the deletion times. I... (7 Replies)
Discussion started by: jose2802
7 Replies

10. UNIX for Advanced & Expert Users

How to list deleted files in UNIX?

Hi All, Its an interview question. I just want to know the answer of below question. 1) How to list deleted files in unix (13 Replies)
Discussion started by: pspriyanka
13 Replies
All times are GMT -4. The time now is 12:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy