Click here to Skip to main content
15,936,119 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am a nowise in programming. Can some please give me a C code that will delete files, whose locations are mentioned in a text file. For example, I have a text file (files.txt) with multiple file paths, one per line. The C program should read the text file and delete the files one by one.

I prefer C because I need to create a 16 bit exe. If someone know a way to create 16-bit exe from VBS, I would really appreciate that as well.

Thanks a lot in advance.
Posted

1 solution

Read the file, line by line.
For each line, pass it to the remove function:
C#
status = remove(strFilename);
if(status == 0)
   {
   printf("%s file deleted successfully.\n", strFilename);
   }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900