Re: removing files
On Mon, Nov 08, 2010 at 11:40:20AM +0530, yoganjaneyulu kasetti wrote: hi, I have a problem for deleting files using scriptplease some one can guide me for the same. I have some files with the extension of .chk extension along with the extension of .log and .gjf extension in the folder called different *input folders. *I wanted to delete the .chk file extension having files. If i go to individual input folder manually i can delete the file with *rm* command line by but i would like to delete all the .chk files extension files at a time through scripting rather than manual. So please some one help me for the same. /student/sweety/gaussiandata/*1249624064640*/input /student/sweety/gaussiandata/*1261202703914*/input /student/sweety/gaussiandata/*1263357080155*/input /student/sweety/gaussiandata/*1289106407303*/input Your examples given here don't seem to match quite what you are asking as far as I see. Maybe I am looking at it wrong. But, anyway, can't you just the -R switch on the rm? cd top_of_tree_with_files_to_delete rm -R *.chk rm -R *.log rm -R *.gjk Or am I missing something. jerry thank you. regards, sweety. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: removing files
On Mon, Nov 08, 2010 at 10:48:18AM -0500, Jerry McAllister wrote: On Mon, Nov 08, 2010 at 11:40:20AM +0530, yoganjaneyulu kasetti wrote: hi, I have a problem for deleting files using scriptplease some one can guide me for the same. I have some files with the extension of .chk extension along with the extension of .log and .gjf extension in the folder called different *input folders. *I wanted to delete the .chk file extension having files. If i go to individual input folder manually i can delete the file with *rm* command line by but i would like to delete all the .chk files extension files at a time through scripting rather than manual. So please some one help me for the same. /student/sweety/gaussiandata/*1249624064640*/input /student/sweety/gaussiandata/*1261202703914*/input /student/sweety/gaussiandata/*1263357080155*/input /student/sweety/gaussiandata/*1289106407303*/input Your examples given here don't seem to match quite what you are asking as far as I see. Maybe I am looking at it wrong. But, anyway, can't you just the -R switch on the rm? cd top_of_tree_with_files_to_delete rm -R *.chk rm -R *.log rm -R *.gjk Or am I missing something. jerry It could be that the OP has more files than the glob can handle. (With most shells there's a restrictionor used to be). I'm also reluctant to use a glob with rm without the -i. With find(1) you can do a dry run first before giving it the -delete argument. The OP also wants to use -maxdepth 1 with find(1) if he doesn't want to traverse the tree below his target dir. Regards, -- Frank Contact info: http://www.shute.org.uk/misc/contact.html ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: removing files
On Mon, Nov 08, 2010 at 08:49:12PM +, Frank Shute wrote: On Mon, Nov 08, 2010 at 10:48:18AM -0500, Jerry McAllister wrote: On Mon, Nov 08, 2010 at 11:40:20AM +0530, yoganjaneyulu kasetti wrote: hi, I have a problem for deleting files using scriptplease some one can guide me for the same. I have some files with the extension of .chk extension along with the extension of .log and .gjf extension in the folder called different *input folders. *I wanted to delete the .chk file extension having files. If i go to individual input folder manually i can delete the file with *rm* command line by but i would like to delete all the .chk files extension files at a time through scripting rather than manual. So please some one help me for the same. /student/sweety/gaussiandata/*1249624064640*/input /student/sweety/gaussiandata/*1261202703914*/input /student/sweety/gaussiandata/*1263357080155*/input /student/sweety/gaussiandata/*1289106407303*/input Your examples given here don't seem to match quite what you are asking as far as I see. Maybe I am looking at it wrong. But, anyway, can't you just the -R switch on the rm? cd top_of_tree_with_files_to_delete rm -R *.chk rm -R *.log rm -R *.gjk Or am I missing something. jerry It could be that the OP has more files than the glob can handle. (With most shells there's a restrictionor used to be). I'm also reluctant to use a glob with rm without the -i. With find(1) you can do a dry run first before giving it the -delete argument. Well, if that is the problem, find is the answer. It should do everything he wants. jerry The OP also wants to use -maxdepth 1 with find(1) if he doesn't want to traverse the tree below his target dir. Regards, -- Frank Contact info: http://www.shute.org.uk/misc/contact.html ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: removing files
On Mon, Nov 8, 2010 at 2:20 AM, Pegasus Mc Cleaft k...@mthelicon.com wrote: On Monday 08 November 2010 06:10:20 yoganjaneyulu kasetti wrote: hi, I have a problem for deleting files using scriptplease some one can guide me for the same. I have some files with the extension of .chk extension along with the extension of .log and .gjf extension in the folder called different *input folders. *I wanted to delete the .chk file extension having files. If i go to individual input folder manually i can delete the file with *rm* command line by but i would like to delete all the .chk files extension files at a time through scripting rather than manual. So please some one help me for the same. /student/sweety/gaussiandata/*1249624064640*/input Could you, in your script do something like: cd /Path_to_Data_Root find . -name *.chk -print -prune -exec rm -rf {} \; If you really want to delete all the .chk files extension files at a time find path -name '*.chk' -print -prune -exec rm -rf {} + \; -- Eitan Adler ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: removing files
On 9-11-2010 6:57, Eitan Adler wrote: If you really want to delete all the .chk files extension files at a time find path -name '*.chk' -print -prune -exec rm -rf {} + \; And more efficient: find path -name '*.chk' -delete Peter -- http://www.boosten.org ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: removing files
On Mon, Nov 8, 2010 at 12:10 AM, yoganjaneyulu kasetti y.emailale...@gmail.com wrote: I have some files with the extension of .chk extension along with the extension of .log and .gjf extension in the folder called different *input folders. *I wanted to delete the .chk file extension having files. If i go to individual input folder manually i can delete the file with *rm* command line by but i would like to delete all the .chk files extension files at a time through scripting rather than manual. So please some one help me for the same. /student/sweety/gaussiandata/*1249624064640*/input /student/sweety/gaussiandata/*1261202703914*/input /student/sweety/gaussiandata/*1263357080155*/input /student/sweety/gaussiandata/*1289106407303*/input man find search for -delete -- Adam Vande More ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: removing files
On Monday 08 November 2010 06:10:20 yoganjaneyulu kasetti wrote: hi, I have a problem for deleting files using scriptplease some one can guide me for the same. I have some files with the extension of .chk extension along with the extension of .log and .gjf extension in the folder called different *input folders. *I wanted to delete the .chk file extension having files. If i go to individual input folder manually i can delete the file with *rm* command line by but i would like to delete all the .chk files extension files at a time through scripting rather than manual. So please some one help me for the same. /student/sweety/gaussiandata/*1249624064640*/input Could you, in your script do something like: cd /Path_to_Data_Root find . -name *.chk -print -prune -exec rm -rf {} \; Peg ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org