Results 1 to 6 of 6
Hi folks,
I'm a linux newbie and I was wondering if there's a command for what I'm wanting to do.
I have a symlink in every folder on my server. ...
- 10-19-2008 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 5
Command to remove same file in all directories please
Hi folks,
I'm a linux newbie and I was wondering if there's a command for what I'm wanting to do.
I have a symlink in every folder on my server. I want to remove these files using one command instead of having to manually go into every directory and remove them.
Thanks for any help.
- 10-20-2008 #2Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
find /path/to/ -name 'myfilename.ext' -exec rm -f '{}' \;
- 10-20-2008 #3Just Joined!
- Join Date
- Oct 2008
- Posts
- 5
Thanks for the reply but that command didn't work.
Someone else told me to use this command and that worked.
Code:find . -name filename.ext -exec rm {} ';'
- 10-20-2008 #4Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Strange, it's exactly the same command (provided that the file names do not have a space in the middle, the only difference is the quoting/escaping methods), the only thing that could have gone wrong is if you didn't write the correct path.
However, the important thing is that you solved it.
- 10-20-2008 #5Just Joined!
- Join Date
- Oct 2008
- Posts
- 5
I didn't actually write the path, I changed into the directory and typed with command without the path section, maybe that's why it didn't work. Gave an error something about the -exec section.
I appreciate you taking time to reply, thank you.
- 10-20-2008 #6Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513


Reply With Quote
