Friday, March 27, 2015

Open files then rename the file


How can i rename the files once the file is open?


For example : When I open first file the file will rename under '1.jpg', then if I open second file the file name will rename under '2.jpg' and so on.


Below code are use to open the files.



System.Diagnostics.Process.Start("C:\Users\hwai\Desktop\Capture\Example.jpg")

Thanks




How can you rename an open file? Files are not supposed to be renamed while opened. How could the application that has the file open access the file if the file was renamed by some other application?


http://ift.tt/1a0NwSg


The forget to mention in the below information quoted from the above link that an exception can be caused if the file to be renamed is in use by another application. Or if the other application does not have the file locked it may crash if it tries to do something with the file and the file is renamed while it is referencing the old path/filename.


"The following conditions may cause an exception:





La vida loca


No comments:

Post a Comment