problem deleting multiple files using rm in UNIX


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers problem deleting multiple files using rm in UNIX
# 1  
Old 10-06-2011
Data problem deleting multiple files using rm in UNIX

I'm baffled..... the system I work on creates files every Mon-Friday
I'm trying to delete all files older than 30 days old from a Unix prompt, the command I'm using is:

find /directory/ -mtime +30 -exec rm {} \;

however it returns /directory/filename: 644 mode ? (y/n) for every file! In most directories I have 50+ files.... But, if I log in (same userid) thru a FTP program and highlight all the files I want to delete it deletes them (the ftp program shows: DELETE file | RM file)

How can I delete multiple files from a Unix prompt without getting the '644 mode' response for everyfile? Thanks!!!
# 2  
Old 10-06-2011
try using force option as below:

Code:
find /directory/ -mtime +30 -exec rm -f {} \;

plus if you want to make sure you are only deleting files you should add the type option to your find:

Code:
find /directory/ -type f -mtime +30 -exec rm -f {} \;

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting multiple files off an ftp server once they have been downloaded

Hello, I have a server that I have to ftp files off and they all start SGRD and are followed by 6 numbers. SGRD000001 SGRD000002 SGRD000003 The script I have will run every 10 mins to pick up files as new ones will be coming in all the time and what I want to do is delete the files I have... (7 Replies)
Discussion started by: sph90457
7 Replies

2. Shell Programming and Scripting

Deleting files using UNIX

Hi All , I am using the below if condition to delete files . if then if ; then log_err "Trigger File ${LINKTRIGGER} does not exist!" fi log_msg "Deleting the Linktrigger" rm -v ${LANDINGDIR}/${LINKTRIGGER}.* else if ; then log_err "Trigger File ${TRGFILE} does not exist!" echo... (11 Replies)
Discussion started by: Hypesslearner
11 Replies

3. Homework & Coursework Questions

Problem with Shell Scripts deleting text in files.

Me and a friend are working on a project, and We have to create a script that can go into a file, and replace all occurances of a certain expression/word/letter with another using Sed. It is designed to go through multiple tests replacing all these occurances, and we don't know what they will be so... (1 Reply)
Discussion started by: Johnny2518
1 Replies

4. Programming

Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine. So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files. My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies

5. Shell Programming and Scripting

Problem in deleting files

Hi Guys, In one of my folders i have 10000 log files starting with sqlfile..... Iam trying to delete the log files alone from the folder using for loop but i am getting an error ksh: /usr/bin/ls: 0403-027 The parameter list is too long. For loop i used for i in `ls sqlfile*`... (4 Replies)
Discussion started by: mac4rfree
4 Replies

6. UNIX for Dummies Questions & Answers

Deleting Multiple Files With the Same Content

My website has been hacked and i need to remove a lot of unique files with same content. The files have very similar code: eval(base64_decodeHow do i find multiple/all the files with the above code and remove them? Thanks. (10 Replies)
Discussion started by: Boris_yo
10 Replies

7. Shell Programming and Scripting

Deleting a column in multiple files that are comma separated

Hi, I have a directory that contains say 100 files named sequencially like input_1.25_50_C1.txt input_1.25_50_C2.txt input_1.25_50_C3.txt input_1.25_50_C4.txt .. .. .. input_1.25_50_C100.txt an example of the content in each of the file is: "NAME" "MEM.SHIP" "cgd1_10" "cgd1_10"... (9 Replies)
Discussion started by: Lucky Ali
9 Replies

8. Shell Programming and Scripting

deleting lines from multiple text files

I have a directory full of text data files. Unfortunately I need to get rid of the 7th and 8th line from them all so that I can input them into a GIS application. I've used an awk script to do one at a time but due to the sheer number of files I need some kind of loop mechanism to automate... (3 Replies)
Discussion started by: vrms
3 Replies

9. Shell Programming and Scripting

deleting multiple files through ftp

Hi, I have a situation where I need to delete multiple files from a folder once I connect to FTP server. I am using ftp script to get the files, number of files always vary from 1 to 100. once I get the files I need to delete all the files downloaded I am making a list of all the files... (4 Replies)
Discussion started by: mgirinath
4 Replies

10. UNIX for Dummies Questions & Answers

Deleting Unix files from DOS

I have a DOS script on Windows NT that uses FTP to connect to a Unix server and to copy files to the WinNT. So far, so good. Now I want to delete those files on Unix afterwards but I'm unable to delete all files in the directory. How can I delete all the files on Unix from where i did ftp all... (3 Replies)
Discussion started by: vidireporting
3 Replies
Login or Register to Ask a Question