![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removing certain text from multiple filenames | Djaunl | UNIX for Dummies Questions & Answers | 6 | 01-15-2008 05:52 PM |
| Getting a list of filenames of moved files | chengwei | Shell Programming and Scripting | 3 | 04-23-2007 03:25 AM |
| read list of filenames from text file, archive, and remove | fxvisions | Shell Programming and Scripting | 5 | 03-20-2007 09:56 PM |
| can I save list of files in memory and not in text file? | umen | Shell Programming and Scripting | 1 | 06-05-2006 04:27 AM |
| grep multiple text files in folder into 1 text file? | coppertone | UNIX for Dummies Questions & Answers | 7 | 08-23-2002 02:50 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
read list of filenames from text file and remove these files in multiple directories
I have a large list of filenames from an Excel sheet, which I then translate into a simple text file. I'd like to use this list, which contains various file extensions , to archive these files and then remove them recursively through multiple directories and subdirectories. So far, it looks like a combination of find, pipe, and xargs may work, but would like to consult some gurus. Thanks in advance!! >
![]() |
|
||||
|
Please give a try on this:
find dir_name -name file -print -exec tar -cvf arch.tar {} \; -exec rm -f {} \; Ex: find ./test_dir -name log_file* -print -exec tar -cvf log_arch.tar {} \; -exec rm -f {} \; thank you. |
|
||||
|
another solution maybe
i found this solutions in some forum lately...
it reads a list of files (with or without pathnames) from a file and removes/deletes them using rm. Code:
xargs rm -rf </lists/blah.txt others use this Code:
cat filename.txt | while read file; do rm "$file"; done Last edited by axel1973; 08-07-2008 at 06:06 AM.. |
|
|||||
|
Quote:
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|