batch delete using find, files with # character


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers batch delete using find, files with # character
# 1  
Old 05-30-2006
batch delete using find, files with # character

UPDATE: Sorry, disregard this.

It did work, I made a mistake; I just shouldn't have been using maxdepth.

I do think it is good to know, however, that

find | grep '#' | xargs rm

will "clean up" funnily named files in a directory. Of course, some of those funnily named files are there for a reason so use with care...

************************

I want to delete files containing #.

find -maxdepth 1 | grep '#'

gives me the files I want to delete, but when I try piping this into xargs with

find -maxdepth 1 | grep '#' | xargs rm

I get

rm: missing operand.

Is there some way I can get batched delete of files with special chars?

Thanks!

Last edited by tphyahoo; 05-30-2006 at 01:11 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Delete Directories and its files that begin with the same character string

I wrote a shell script program that supposed to delete any directories and its files that begin with the same character string . The program is designed to delete directories and its files that are one day old or less and only the directories that begin with the same character string. The problem... (1 Reply)
Discussion started by: dellanicholson
1 Replies

2. UNIX for Dummies Questions & Answers

Find command to delete old files

Hi, I want to delete all the log files that was created on year 2008. My command is not working. Any idea? find . -name '*.log' -mtime 1460 -exec ls -lt {} \; Thank you. (2 Replies)
Discussion started by: samnyc
2 Replies

3. UNIX for Dummies Questions & Answers

Script to find the files and delete them

This is a real world problem so I think you might found this interesting. We have servers which are shared by multiple team members. Each team member has its own user id and home directory. Now with time each user starts creating files which in end caused the disk to be full. Now for creating a... (5 Replies)
Discussion started by: Rohit06
5 Replies

4. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

5. Shell Programming and Scripting

find files for a particular date and delete

How can I delete files for a particular date ? I apologize in advance If there is solution please put the link. Thanks, (5 Replies)
Discussion started by: jville
5 Replies

6. UNIX for Dummies Questions & Answers

find and delete files

hi all , i want to find and interactively delete all the files having size greater than 20 bytes using "find" and other commands..... (8 Replies)
Discussion started by: sonu_pal
8 Replies

7. Shell Programming and Scripting

A Batch job to delete files from various directories

Hi, I have a shell script to find files older than 'X' days ($2) in directory path ($1) and delete them. Like this: my_file_remover.sh /usr/home/c 90 Now, I need to modify this script and add it in CRON, so that it checks other directories also. Like: my_file_remover.sh /usr/home/c... (3 Replies)
Discussion started by: guruparan18
3 Replies

8. Shell Programming and Scripting

need to find last character in each line in all files

Hi, I need to read each line in all files .If last character in each line is not ;(semicolon) then i need to append next line also.Here each line may consists of multiple semicolons(;).but i need to read only last character.I need to achieve this using shell script.And i need to remove tht last... (7 Replies)
Discussion started by: dbsurf
7 Replies

9. UNIX for Dummies Questions & Answers

Find files which contain a null character

Hi, I would like to use grep to find files which contain NULL characters. I'm not sure how to represent the null character in the grep statement. Could anyone help please? Thanks! Helen :confused: (5 Replies)
Discussion started by: Bab00shka
5 Replies

10. Windows & DOS: Issues & Discussions

Schedule a Batch file to delete files at particular intervals

Hi, I need to write a batch file/shell script that runs at specified intervals daily and deletes specified set of files. Can anyone pls help me with the code. Thanks, Indom. (6 Replies)
Discussion started by: Indom
6 Replies
Login or Register to Ask a Question
LDD(1)							    BSD General Commands Manual 						    LDD(1)

NAME
ldd -- list dynamic object dependencies SYNOPSIS
ldd [-a] [-v] [-f format] program ... DESCRIPTION
The ldd utility displays all shared objects that are needed to run the given program or to load the given shared object. Contrary to nm(1), the list includes ``indirect'' dependencies that are the result of needed shared objects which themselves depend on yet other shared objects. Zero, one or two -f options may be given. The argument is a format string passed to rtld(1) and allows customization of ldd's output. If one is given, it sets LD_TRACE_LOADED_OBJECTS_FMT1. If two are given, they set LD_TRACE_LOADED_OBJECTS_FMT1 and LD_TRACE_LOADED_OBJECTS_FMT2, respectively. See rtld(1) for details, including a list of recognized conversion characters. The -a option displays the list of all objects that are needed by each loaded object. This option does not work with a.out(5) binaries. The -v option displays a verbose listing of the dynamic linking headers encoded in the executable. See the source code and include files for the definitive meaning of all the fields. EXAMPLES
The following is an example of a shell pipeline which uses the -f option. It will print a report of all ELF binaries in the current direc- tory, which link against libc.so.6: find . -type f | xargs -n1 file -F ' ' | grep ELF | cut -f1 -d' ' | xargs ldd -f '%A %o ' | grep libc.so.6 SEE ALSO
ld(1), nm(1), rtld(1) HISTORY
A ldd utility first appeared in SunOS 4.0, it appeared in its current form in FreeBSD 1.1. The -v support is based on code written by John Polstra <jdp@polstra.com> BSD
May 15, 2008 BSD