Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
rm -f /obi/u01/informatica/v711/pmserver/SrcFiles/coe/aone/AccessOne_Daily_Input.xml

What is its use in unix and its possible implementation in dos?

share|improve this question

migrated from Aug 12 '09 at 8:35

This question came from our site for professional and enthusiast programmers.

It is NOT DOS. cmd.exe is a native Windows application. – grawity Aug 12 '09 at 9:13
Maybe the OP still uses DOS. There definitely were questions specific to DOS. – Joey Aug 12 '09 at 9:32
Well, it was originally tagged "windows". – grawity Aug 12 '09 at 12:48

It just forces a file to be deleted, even if it's read-only.

del /f filename

is the rough equivalent in Windows command shells.

share|improve this answer
Much as I hate voting up Jon, he's exactly right. +1. – paxdiablo Aug 12 '09 at 6:13
Every vote you get, brings you 10 points closer to integer overflow :-D – derobert Aug 12 '09 at 6:49
Luckily one can safely upvote him here, as he isn't nearly close to overflowing :-) – Joey Aug 12 '09 at 9:33

rm -f forces the delete of a file. IF you need to delete everything in a specific folder, including folders withing folders, you would need to do rm -rf in unix.

share|improve this answer

If you feel comfortable with UNIX commands, you can use a UNIX command shell simulator in windows, the one that I use is called CYGWIN:

share|improve this answer

rm -f <filename> deletes <filename> if it exists, even if it is read-only to the current user. If <filename> does not exist, rm -f <filename> silently returns success. If attempting to delete <filename> results in a permissions error or <filename> is a directory, rm will exit with an error message. See POSIX.1-2008 Shell & Utilities: rm.

This is useful in one-off situations where you want to ensure that a particular file does not exist. rm -f will silently succeed if the file doesn’t exist; it will attempt to even remove a read-only file if it already exists. It saves you from having to check that the file exists first or enabling the file’s write permission bit. This makes it very useful in a Makefile’s conventional clean target because you want to ensure that all built files are deleted without having to put conditional shell code around every single rm invocation.

DEL has an /F flag which causes DEL to go ahead and delete files for which you do not have write permission. However, it will still complain if you try to remove a nonexistent file (unlike rm -f):

C:\Users\binki>DEL /F nonexistent
Could Not Find C:\Users\binki\nonexistent

C:\Users\binki>rm -f nonexistent


Maybe there is a better way, but I think rm -f’s behavior can only be replicated with the help of IF EXIST. Thus, I propose IF EXIST <filename> DEL /F <filename> to be the closest available cmd syntax to replicate the behavior of rm -f <filename>:

C:\Users\binki>IF EXIST nonexistent DEL /F nonexistent

C:\Users\binki>touch existent& chmod u-w existent

C:\Users\binki>DEL existent
Access is denied.

C:\Users\binki>IF EXIST existent DEL /F existent

C:\Users\binki>ls -l existent
ls: existent: No such file or directory

share|improve this answer

You must log in to answer this question.