ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I want to write a short bash script to rm all files in a directory. I have a couple of directories that have too many files to use wild cards (!, returns a 'too many arguements error), which is hosing up my machine. So, I want to use a bash script that deletes them one at a time (perhaps a repeating loop that deletes the first file in the directory, the most recent file or whatever). My bash skills are negligible. Can anyone suggest a short script?
I posted something similar in the Newbie sections, which has a description of the more general problem.
I havent read your other thread but if I wanted to delete everything in a directory, I would use "rm -rf /dir" & that removes EVERYTHING in the /dir, the r switch tell's it to recursively travel through the directory & f tell's it to force so your not repeatedly asked , are you sure?
The whole point was that he couldn't use wildcards because he had to many files. So with or without the -i options it wouldn't work either way.
But this is a very old thread so I'm sure he's got his solution by now.