rm long list of files in a directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting rm long list of files in a directory
# 15  
Old 08-21-2009
But I bet the files are still there (tongue in cheek).

Code:
find /path/to/dir/ -iname '*.pdf' -exec echo rm '{}' ';'

# 16  
Old 08-21-2009
Quote:
Originally Posted by techmoris
find /path/to/dir/ -iname '*.pdf' -exec echo rm '{}' ';'

This worked!!
funny, cause you just posted:
Quote:
Originally Posted by techmoris
find /path/to/dir/ -iname '*.pdf' -exec echo rm '{}' ';'

after running this command, I am getting the following error:

find: bad option -iname
what changed???

---------- Post updated at 10:53 PM ---------- Previous update was at 10:52 PM ----------

Quote:
Originally Posted by methyl
But I bet the files are still there (tongue in cheek).

Code:
find /path/to/dir/ -iname '*.pdf' -exec echo rm '{}' ';'

and he's searching for pdfs now...
# 17  
Old 08-21-2009
Yep that command line had a number of typos which meant that it didn't delete files.

Quote:
find /path/to/dir/ -iname '*.pdf' -exec echo rm '{}' ';'
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

2. Shell Programming and Scripting

Copy list of files from a keyword list to another directory

Hello, I have a folder with a massive amount of files, and I want to copy out a specific subset of the files to a new directory. I would like to use a text file with the filenames listed, but can't get it to work. The thing I'm hung up on is that the folder names in the path can and do have... (5 Replies)
Discussion started by: twjolson
5 Replies

3. Shell Programming and Scripting

Need Help Moving Long List Of Files Into Directories

I am very new to BASH and I am having difficulties moving a long list of image files into similarly named directories. I've been trying to come with a script all night and no luck. Here is what my list of files looks like: DSC_0059_01.jpg DSC_0059_02.jpg DSC_0059_03.jpg DSC_0059_04.jpg... (5 Replies)
Discussion started by: jowens1138
5 Replies

4. Solaris

Replacing a string in a long list of files

I have a script that needs to read a file with a long list of /path/filenames - replace the name of the server in each file - and write the file to the same path with a date extension. This is the script that I have so far #!/bin/ksh umask 022 LIST=`scripts.list` for i in $LIST do ... (2 Replies)
Discussion started by: bjdamon
2 Replies

5. Solaris

calculate sum size of files by date (arg list too long)

Hi, I wanted a script to find sum of files for a particular date, below is my script ls -lrt *.req | nawk '$6 == "Aug"' | nawk '$7 == "1"'| awk '{sum = sum + $5} END {print sum}' However, i get the error below /usr/bin/ls: arg list too long How do i fix that. Many thanks before. (2 Replies)
Discussion started by: beginningDBA
2 Replies

6. Shell Programming and Scripting

TAR Files Argument list too long error

Hi, I have a requirement where I need to TAR more than 50K files. Even though I can do TAR successfully on few 100s of files, but whenever Im trying to TAR the entire 50K files, I am getting the error message : Argument List Too Long. Please suggest how can i avoid this error. Im... (2 Replies)
Discussion started by: unx100
2 Replies

7. Shell Programming and Scripting

find list of files from a list and copy to a directory

I will be very grateful if someone can help me with bash shell script that does the following: I have a list of filenames: A01_155716 A05_155780 A07_155812 A09_155844 A11_155876 that are kept in different sub directories within my current directory. I want to find these files and copy... (3 Replies)
Discussion started by: manishabh
3 Replies

8. UNIX for Dummies Questions & Answers

Find files and display only directory list containing those files

I have a directory (and many sub dirs beneath) on AIX system, containing thousands of file. I'm looking to get a list of all directory containing "*.pdf" file. I know basic syntax of find command, but it gives me list of all pdf files, which numbers in thousands. All I need to know is, which... (4 Replies)
Discussion started by: r7p
4 Replies

9. UNIX for Dummies Questions & Answers

arg list too long when trying to tar files

Hi, I am trying to perform this task: tar -cvf tar.newfile ??????.bas I got error "arg list too long". Is ther any way around? I have about 1500 file need to be tar together. Thanks in advance (5 Replies)
Discussion started by: jds3
5 Replies

10. UNIX for Dummies Questions & Answers

arg list too long when mv files?

hello all i need some help because i am a unix/linux dummy...i have the following: DIR1> has 121437 files in it with varying dates going back to early April, a sub dir DIR1/DIR2> has 55835 files in it I need to move all files (T*.*) out of DIR1 into DIR2 that are older than today? Ive been... (2 Replies)
Discussion started by: jamos007
2 Replies
Login or Register to Ask a Question