run a program for everytime a file is copied to a specified folder..
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: run a program for everytime a file is copied to a specified folder..

  1. #1
    Join Date
    Apr 2011
    Posts
    54

    run a program for everytime a file is copied to a specified folder..

    anyone have done a code like this?


    if i have users that copies files to a local or network folder, i wanted this "copy" or "move" as a trigger to to run a program that would prompt the user to enter a "prefix" for their file (or files) so in the end, this program will place the 'renamed' file instead of the orginal file name(s).

    e.g.

    user copy/move file: mysampleimage.tif

    once the user copy/move this file to c:\source_directory\ a prompt will appear so user can enter prefix, e.g. user enters: ABC123 then the filename will be ABC123mysampleimage.tif

    also, handling multiple file copy/move:

    user copy/move *.tif (e.g. 10 files), then user enters: TEST123, then all the files will be named with TEST123 as prefix for the file names.

  2. #2
    Join Date
    Apr 2012
    Posts
    2

    Re: run a program for everytime a file is copied to a specified folder..

    There is a control that can monitor changes of a directory, a standard control (I forgot it's name, but you can find it in the toolbox)

    When a user moves/copys a file, a file would be created on that folder in which the control will fire an event, you can then popup an inputbox and after that rename the file (which is done by file.move)

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,091

    Re: run a program for everytime a file is copied to a specified folder..

    It is the FileSystemWatcher component :

    http://msdn.microsoft.com/en-us/libr...emwatcher.aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center