moving files in C
Here's the problem.
I have a batch file that moves files from one directory to another, using the "move" command.
It works ok.
But when I try to run it from a C program using the function "system("file.bat");", the move command doesn't work.
Giving the error message: "invalid command or bad filename".
The line on the batch file is simply:
move c:\enc\hist\*.lst c:\enc\
Thanks to all.
I know next to nothing about programming in windows but I am guessing usuallly some sort of shell processes the wildcard character in the file name.
My program is supposed to run in DOS 6.
Anyway, I only want to move all files from one directory to another.
I believe that the problem is that when using the program, DOS doesn't recognize the "move" command. But recognizes others, like "DIR".
This is strange.. any ideas?
Hey, instead of "move", used "copy" + "del" and it works.
Indeed, DOS doesn't have MOVE as a command, so you need to copy the file, then delete the original.
But when I use the move command in the console or in the batch file, it works fine.
It only has problems when I call the file from the program...
Any idea of how I make it work using only C code?
Are you mixing up real, authentic DOS with a DOS shell?
If you want to move files using C, the method to do it depends if you're using DOS or Windows.