HOWTO: Deal with Files -- Move, Copy, Delete 
Author Message
 HOWTO: Deal with Files -- Move, Copy, Delete

This seems so stupidly simple. Course I'm fairly new at this. Why can't I
find sample code on how to do this. I need to know how to do the following:
Test if a file is in a particular folder.
Move the file to a different folder.
Delete the file from the orginal folder.

Thanks in Advance!!
--
HowlingMan



Sat, 23 Oct 2004 22:58:09 GMT  
 HOWTO: Deal with Files -- Move, Copy, Delete

Quote:

> This seems so stupidly simple. Course I'm fairly new at this. Why can't I
> find sample code on how to do this. I need to know how to do the following:
> Test if a file is in a particular folder.
> Move the file to a different folder.
> Delete the file from the orginal folder.

You might want to have a look at the SDK function MoveFile. If the
sourcefile doesn't exist the function will fail, so you can test the
return value.
The MSDN library also provides an example on this function.

Regards,
Ruben.



Sat, 23 Oct 2004 23:22:53 GMT  
 HOWTO: Deal with Files -- Move, Copy, Delete
Take a look at SHFileOperation(...).

TFM3

Note: Spam-resistant e-mail address



Quote:
> This seems so stupidly simple. Course I'm fairly new at this. Why can't I
> find sample code on how to do this. I need to know how to do the
following:
> Test if a file is in a particular folder.
> Move the file to a different folder.
> Delete the file from the orginal folder.

> Thanks in Advance!!
> --
> HowlingMan



Sat, 23 Oct 2004 23:38:50 GMT  
 HOWTO: Deal with Files -- Move, Copy, Delete
Hi Joel,

As suggested by Thomas SHFileOperation would be your best bet.
the follwoing MSDN article would be of help
http://msdn.microsoft.com/library/en-us/shellcc/platform/Shell/progra...
ide/shell_basics/shell_basics_programming/manage.asp?frame=true#moving
also llok at this article
http://www.codeguru.com/files/SHFILEOPSTRUCT.shtml



Quote:
> This seems so stupidly simple. Course I'm fairly new at this. Why can't I
> find sample code on how to do this. I need to know how to do the
following:
> Test if a file is in a particular folder.
> Move the file to a different folder.
> Delete the file from the orginal folder.

> Thanks in Advance!!
> --
> HowlingMan



Sun, 24 Oct 2004 02:05:27 GMT  
 HOWTO: Deal with Files -- Move, Copy, Delete
Look at the CFile class.  Use the GetStatus() function to check for
existence.  Use series of Read()/Write() functions to copy a file.  Use the
Remove() function to remove a file.



Quote:
> This seems so stupidly simple. Course I'm fairly new at this. Why can't I
> find sample code on how to do this. I need to know how to do the
following:
> Test if a file is in a particular folder.
> Move the file to a different folder.
> Delete the file from the orginal folder.

> Thanks in Advance!!
> --
> HowlingMan



Sun, 24 Oct 2004 03:46:52 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Help needed:File copying, deleting or moving

2. File.Move File.Delete

3. HOWTO: Install/copy COM file, and register it.

4. howto: undo delete files after SHFileOperation

5. moving en copying files in C?

6. silly question, how to copy/move a file

7. Copying and moving files

8. File (Move or Copy)

9. Rename, Copy and Delete a file ...?

10. ***Copy & Deleting files in a program

11. How to copy and delete files ?

12. delete, copy, rename files ???

 

 
Powered by phpBB® Forum Software