I have created a dos script which deletes files in "g:/documents and settings/ravi kiran/recent" where my OS installed in g: drive. when i run the script it is promting for Y/N. so I have given input from a file "kiran.txt" using input redirector.But it is not working. the code is below.

code:
cd "g:\Documents and settings\ravi kiran\recent"
del /f * < kiran.txt

the file kiran.txt contains character 'y'

the code is running but it i not deleting files.
can anyone help me please........

Recommended Answers

All 5 Replies

>the code is running but it i not deleting files.
I'm skeptic that this script runs properly. To start kiran.txt is in the same current directory that you are trying to delete *everything*.
And just in case, DEL only deletes files, but not directories.

>the code is running but it i not deleting files.
I'm skeptic that this script runs properly. To start kiran.txt is in the same current directory that you are trying to delete *everything*.
And just in case, DEL only deletes files, but not directories.

Thanks for ur reply
but my problem is not with deleting , it deletes all files only if i provide 'y' through keyboard since it is prompting for "yes/no" to delete files. i want to give input through file (input:'y') so that there is no necessary to give through keyboard .but it is not deleting if i give input through file.

Continue to troubleshoot it, manually first, before creating a batch file.
In the current directory make a file that contain the y character alone.
In the current directory create another directory and inside that directory create a couple dummy files. Do not change directories.
Then issue the command.

del /f anotherdirectorybelow < y.txt

Should it worked, you'd have an exchange in the stdout similar to:

C:\currentdirectory\anotherdirectorybelow\*, Are you sure (Y/N)? y

still it is not deleating files if we give input from file and is working if we give input(y/n) from keyboard.

try this.

G: -------> separate the drive letter.
cd "Documents and settings\ravi kiran\recent"
del /f kiran.txt

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.