recursive delete files from txt file or?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers recursive delete files from txt file or?
# 1  
Old 01-29-2011
recursive delete files from txt file or?

i have a txt file of image names that have to be deleted in pwd how can i use the txt file to delete the files in pwd and is it possible?--i might be able to import the txt files into a spreadsheet ahd same it as a csv file. i want it to be done recursive lly --what i mean is teh sysem goes thru each txt file--finds it and then deletes it

i am an advance newbee in unix--which i love!!!!!!

Last edited by Scott; 01-29-2011 at 03:25 PM.. Reason: Do NOT post your email address
# 2  
Old 01-30-2011
so what is in the text file? can you put a sample here.
but you should be able to read the file in and then use the value
added to the pwd output to rm the file(s).
# 3  
Old 01-30-2011
text file structure

here is what my text file looks like
Code:
mary.jpg
joh.jpg
sdfks,jpg
sdfkmom.jpg

what i want to do is use this list to delete these files from my pwd
something like this i believe i want to do
xargs rm < my_input file .txt
i assume what would happen is the utility (xargs) would take 1 line at a time from my_input.txt
find the file in pwd and if found delete it
then take the next line in my_inputfile.txt and do the same and so on
tia
peter

Last edited by Yogesh Sawant; 01-30-2011 at 05:29 PM.. Reason: added code tags
# 4  
Old 01-30-2011
Code:
cat txt.file |xargs rm

# 5  
Old 01-31-2011
thanks

thanks for your help on this
peter
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Delete files in a txt file

Hi, I have very old files in my server like from 2012 and i want to delete them, Please help. Thanks in advance.. (2 Replies)
Discussion started by: nanz143
2 Replies

2. Shell Programming and Scripting

Recursive delete in a file using a set of values in other file

Hi, I have got a file with 6K records and I want to delete 500 records from this file which match the values present in another file. Format of the both the files is different. Example : File 1 record CCCCCC 11292562ABCDEF MBR/PSF6/108100502/BEN01XXX XXX Example : File 2 record... (1 Reply)
Discussion started by: Nikhath
1 Replies

3. UNIX for Dummies Questions & Answers

Script to delete files line by line in .txt document

Friends, I am in need to delete files from a directory on a regular basis. I want to place all the files to be deleted in delete .txt file and require a script to delete files, line by line from this delete.txt file. Please help me with this script as am new to unix scripting. (3 Replies)
Discussion started by: fop4658
3 Replies

4. UNIX for Dummies Questions & Answers

Delete .txt file from current directory

I have created few text file during run time by redirecting the txt file echo USER_LIST_"$(date '+%d%h%Y')".csv > report_location.txt report_location.txt is creating in the same location where I run script home/script When I try to remove the txt file at the end of the... (3 Replies)
Discussion started by: stew
3 Replies

5. Shell Programming and Scripting

Delete specific parts in a .txt file

Hi all, I desperately need a small script which deletes everything in a particular .txt file when "Abs = {" appears till "},", and also when "B-1 = {" appears till "}," I would like all the text in between of those instances to be deleted, however, other text to be unedited (kept as it is).... (12 Replies)
Discussion started by: c_lady
12 Replies

6. UNIX for Dummies Questions & Answers

Delete files whose file names are listed in a .txt file

hi, I need a help. I used this command to list all the log files which are for more than 10 days to a text file. find /usr/script_test -type f -mtime +10>>/usr/ftprm.txt I want all these files listed in the ftprm.txt to be ftp in another machine and then rm the files. Anyone can help me... (8 Replies)
Discussion started by: kamaldev
8 Replies

7. Shell Programming and Scripting

Delete file2.txt from file1.txt using scripting

Hi, I`m a total newbie, well my requirement is that i have 2 files I want to identify which countries i do not currently have in db.. how can i use the grep or another command to find this file .. i want to match all-countries.txt with countries-in-db.txt so the output is equal to... (11 Replies)
Discussion started by: beanbaby
11 Replies

8. Shell Programming and Scripting

script to delete lines from a txt file if pattern matches

File 6 dbnawldb010-b office Memphis_Corp_SQL_Diff Memphis-Corp-SQL-Inc-Application-Backup 03/09/11 03:24:04 42 luigi-b IPNRemitDB Memphis_Corp_SQL_Diff Memphis-Corp-SQL-Inc-Application-Backup 03/10/11 00:41:36 6 ebs-sqldev1-b IPNTracking Memphis_Corp_SQL_Diff... (4 Replies)
Discussion started by: ajiwww
4 Replies

9. Shell Programming and Scripting

Script to delete all something.txt~ file from a directory

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)
Discussion started by: cola
7 Replies

10. UNIX for Dummies Questions & Answers

Command to delete numbers at beginning of txt file line

Hello. I have the following issue: my txt file has the following format: train/dr4/fklc0/sx175.txt 0 80282 Severe myopia contributed to Ron's inferiority complex. train/dr4/fklc0/sx355.txt 0 42906 Dolphins are intelligent marine mammals. train/dr4/fklc0/sa2.txt awk 'NR%2==0' test1.txt >... (4 Replies)
Discussion started by: li_bi
4 Replies
Login or Register to Ask a Question