Windows Vista Forums

Copied file has System and Hidden attribute set.

  1. #1


    QSIDeveloper Guest

    Copied file has System and Hidden attribute set.

    I have a .Net web service that converts the MODCA files to tif or png file
    format.
    This web service runs on a 2003 server.

    This web service first copies the MODCA file to be converted to a temporary
    conversion folder.
    Then it converts it to the desired file format and copies the file to the
    output folder specified.
    Then it deletes the converted file from the temporary conversion folder.
    Then it attempts to delete the copied input file from the temporary
    conversion folder
    The file is not getting deleted. When I look in the explorer, I see that
    the copied files get a System, Hidden and Read only attributes.

    The source file does not have the System and Hidden attribute set.

    Why would the copied file have System, Hidden and Read only attributes set
    and how can we prevent these attributes from being set during copy?


      My System SpecsSystem Spec

  2. #2


    \Ji Zhou [MSFT]\ Guest

    RE: Copied file has System and Hidden attribute set.

    Hello John,

    Glad to see you again and thanks for using the Microsoft Managed Newsgroup
    Support Service. This is Ji Zhou [MSFT] and I will be working on this issue
    with me.

    I have a quick test on my side but did not reproduce your issue. When I use
    the System.IO.File.Copy() method to copy a file to a temporary folder on my
    side, the copied file will have the same attributes as the original one.

    Actually from my testing, even if I set the copied file's attributes to
    System|Hidden|ReadOnly manually, I still can delete it from my local driver
    without any error. So, would you mind letting us to know the exact
    exception text you received when trying to delete the copied file? In my
    opinion, this issue should not be related to the file attribute.

    Here are some suggestions from me depending on whether the issue always
    occurs, or only happens for some time?

    *If it always occurs, considering that before we view its attributes in the
    explorer, our WebService has opened, manipulated, converted the copied to
    new format file, I think the error we are facing resulted from not closing
    the FileStream after using it. The correct version codes will roughly look
    like,

    private void button1_Click(object sender, EventArgs e)
    {
    System.IO.FileStream fs = System.IO.File.Open(@"D:\Temporary\test.txt",
    System.IO.FileMode.Open);
    //codes to convert the format
    fs.Close(); //make sure we close the file stream.
    }

    *And if this issue only happens from time to time, to narrow down issues
    about file cannot get deleted, I recommend to download the tool Process
    Explorer from http://technet.microsoft.com/en-us/s.../bb896653.aspx
    for troubleshooting. This tool can be used to find the file handle's
    ownership. You can get more detailed information in the following Microsoft
    KB article,
    http://support.microsoft.com/kb/232830

    Please let me know if the above information helps to resolve your problem.
    If not, would you mind posting some of your codes about format converting
    or sending a mini reproducible project to me at v-jzho@xxxxxx. I
    will try my best to help.


    Best regards,
    Ji Zhou (v-jzho@xxxxxx, remove 'online.')
    Microsoft Online Community Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    msdnmg@xxxxxx.

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subs...#notifications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://support.microsoft.com/select/...tance&ln=en-us.
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.


      My System SpecsSystem Spec

  3. #3


    QSIDeveloper Guest

    RE: Copied file has System and Hidden attribute set.

    Hello Ji Zhou

    Unfortunately this is happening on a customer’s machine in production and we
    have not captured the exception text. We are suspicious that the delete
    issue is that the file is marked as system.

    We can not reproduce the issue on our development servers.

    What I was hoping was that you could provide some insight on why/how the
    attributes of the copied file would be changed from the source file in this
    scenario. This code is running in a web service using the default
    application pool a under Network Service account.


    """Ji Zhou [MSFT]""" wrote:

    > Hello John,
    >
    > Glad to see you again and thanks for using the Microsoft Managed Newsgroup
    > Support Service. This is Ji Zhou [MSFT] and I will be working on this issue
    > with me.
    >
    > I have a quick test on my side but did not reproduce your issue. When I use
    > the System.IO.File.Copy() method to copy a file to a temporary folder on my
    > side, the copied file will have the same attributes as the original one.
    >
    > Actually from my testing, even if I set the copied file's attributes to
    > System|Hidden|ReadOnly manually, I still can delete it from my local driver
    > without any error. So, would you mind letting us to know the exact
    > exception text you received when trying to delete the copied file? In my
    > opinion, this issue should not be related to the file attribute.
    >
    > Here are some suggestions from me depending on whether the issue always
    > occurs, or only happens for some time?
    >
    > *If it always occurs, considering that before we view its attributes in the
    > explorer, our WebService has opened, manipulated, converted the copied to
    > new format file, I think the error we are facing resulted from not closing
    > the FileStream after using it. The correct version codes will roughly look
    > like,
    >
    > private void button1_Click(object sender, EventArgs e)
    > {
    > System.IO.FileStream fs = System.IO.File.Open(@"D:\Temporary\test.txt",
    > System.IO.FileMode.Open);
    > //codes to convert the format
    > fs.Close(); //make sure we close the file stream.
    > }
    >
    > *And if this issue only happens from time to time, to narrow down issues
    > about file cannot get deleted, I recommend to download the tool Process
    > Explorer from http://technet.microsoft.com/en-us/s.../bb896653.aspx
    > for troubleshooting. This tool can be used to find the file handle's
    > ownership. You can get more detailed information in the following Microsoft
    > KB article,
    > http://support.microsoft.com/kb/232830
    >
    > Please let me know if the above information helps to resolve your problem.
    > If not, would you mind posting some of your codes about format converting
    > or sending a mini reproducible project to me at v-jzho@xxxxxx. I
    > will try my best to help.
    >
    >
    > Best regards,
    > Ji Zhou (v-jzho@xxxxxx, remove 'online.')
    > Microsoft Online Community Support
    >
    > Delighting our customers is our #1 priority. We welcome your comments and
    > suggestions about how we can improve the support we provide to you. Please
    > feel free to let my manager know what you think of the level of service
    > provided. You can send feedback directly to my manager at:
    > msdnmg@xxxxxx.
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/en-us/subs...#notifications.
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://support.microsoft.com/select/...tance&ln=en-us.
    > ==================================================
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >

      My System SpecsSystem Spec

  4. #4


    Andrew Morton Guest

    Re: Copied file has System and Hidden attribute set.

    QSIDeveloper wrote:

    > I have a .Net web service that converts the MODCA files to tif or png
    > file format.
    > This web service runs on a 2003 server.
    >
    > This web service first copies the MODCA file to be converted to a
    > temporary conversion folder.
    > Then it converts it to the desired file format and copies the file to
    > the output folder specified.
    > Then it deletes the converted file from the temporary conversion
    > folder. Then it attempts to delete the copied input file from the
    > temporary conversion folder
    > The file is not getting deleted. When I look in the explorer, I see
    > that the copied files get a System, Hidden and Read only attributes.
    >
    > The source file does not have the System and Hidden attribute set.
    >
    > Why would the copied file have System, Hidden and Read only
    > attributes set and how can we prevent these attributes from being set
    > during copy?
    Are the new files /inheriting/ the attributes? Couldn't you explicitly set
    the attributes the way you need them to be?

    Andrew



      My System SpecsSystem Spec

  5. #5


    \Ji Zhou [MSFT]\ Guest

    RE: Copied file has System and Hidden attribute set.

    Hello John,

    Thanks for the information! Since the issue only happens on a particular
    user's computer, we can say it should not be related to our codes, but
    related to the specific environment, right?

    If that is the case, my best guess is that the file's attributes may be
    changed by other applications or services running on that computer, like
    Google Desktop Search, Winzip, Windows Searching Index or a virus-anti
    software. These applications has a commonness that may run in background to
    iterate through all files on the local driver, and lock, manipulate them. I
    would like suggest your customer to check this.

    By the way, I am not very sure if the System attribute is the real root of
    the problem. In my opinion, when a file cannot be deleted, the most two
    possibility to are,

    1.Security issue. If the current user does not have the permission to
    delete the System attribute file, the issue can occur.

    2.Lock issue. The file is manipulated by another process and not released.
    That is to say the file is locked.


    However, I highly recommend you two tools that may be very helpful to
    troubleshooting this issue.

    1.The Process Explorer which I have mentioned in my first reply already. If
    the reason is the file is locked by other process. We can easily find the
    file handle's ownership in the Process Explorer as described in the
    Microsoft KB articles.

    2.The Process Monitor which is available in this link
    http://technet.microsoft.com/en-us/s.../bb896645.aspx. This tool is
    also very powerful to trace all actions on all files in the machine. In
    this case, we can find which application changes the file's attribute to
    System|Hidden|ReadOnly. The following is an example. If I set a
    file(D:\test.txt)'s attribute to ReadOnly|Hidden from explorer, I can find
    the following log in ProcessMon,

    9612 4:25:23.3918150 PM Explorer.EXE 3724 SetBasicInformationFile
    D:\test.txt SUCCESS CreationTime: 1/1/1601 8:00:00 AM, LastAccessTime:
    1/1/1601 8:00:00 AM, LastWriteTime: 1/1/1601 8:00:00 AM, ChangeTime:
    1/1/1601 8:00:00 AM, FileAttributes: RHAN


    Best regards,
    Ji Zhou (v-jzho@xxxxxx, remove 'online.')
    Microsoft Online Community Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    msdnmg@xxxxxx.

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subs...#notifications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://support.microsoft.com/select/...tance&ln=en-us.
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.


      My System SpecsSystem Spec

  6. #6


    QSIDeveloper Guest

    RE: Copied file has System and Hidden attribute set.

    We discovered that a 3rd party tool we are using was writing to the input
    file and that was changing the attributes.

    Thanks for the help.


    """Ji Zhou [MSFT]""" wrote:

    > Hello John,
    >
    > Thanks for the information! Since the issue only happens on a particular
    > user's computer, we can say it should not be related to our codes, but
    > related to the specific environment, right?
    >
    > If that is the case, my best guess is that the file's attributes may be
    > changed by other applications or services running on that computer, like
    > Google Desktop Search, Winzip, Windows Searching Index or a virus-anti
    > software. These applications has a commonness that may run in background to
    > iterate through all files on the local driver, and lock, manipulate them. I
    > would like suggest your customer to check this.
    >
    > By the way, I am not very sure if the System attribute is the real root of
    > the problem. In my opinion, when a file cannot be deleted, the most two
    > possibility to are,
    >
    > 1.Security issue. If the current user does not have the permission to
    > delete the System attribute file, the issue can occur.
    >
    > 2.Lock issue. The file is manipulated by another process and not released.
    > That is to say the file is locked.
    >
    >
    > However, I highly recommend you two tools that may be very helpful to
    > troubleshooting this issue.
    >
    > 1.The Process Explorer which I have mentioned in my first reply already. If
    > the reason is the file is locked by other process. We can easily find the
    > file handle's ownership in the Process Explorer as described in the
    > Microsoft KB articles.
    >
    > 2.The Process Monitor which is available in this link
    > http://technet.microsoft.com/en-us/s.../bb896645.aspx. This tool is
    > also very powerful to trace all actions on all files in the machine. In
    > this case, we can find which application changes the file's attribute to
    > System|Hidden|ReadOnly. The following is an example. If I set a
    > file(D:\test.txt)'s attribute to ReadOnly|Hidden from explorer, I can find
    > the following log in ProcessMon,
    >
    > 9612 4:25:23.3918150 PM Explorer.EXE 3724 SetBasicInformationFile
    > D:\test.txt SUCCESS CreationTime: 1/1/1601 8:00:00 AM, LastAccessTime:
    > 1/1/1601 8:00:00 AM, LastWriteTime: 1/1/1601 8:00:00 AM, ChangeTime:
    > 1/1/1601 8:00:00 AM, FileAttributes: RHAN
    >
    >
    > Best regards,
    > Ji Zhou (v-jzho@xxxxxx, remove 'online.')
    > Microsoft Online Community Support
    >
    > Delighting our customers is our #1 priority. We welcome your comments and
    > suggestions about how we can improve the support we provide to you. Please
    > feel free to let my manager know what you think of the level of service
    > provided. You can send feedback directly to my manager at:
    > msdnmg@xxxxxx.
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/en-us/subs...#notifications.
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://support.microsoft.com/select/...tance&ln=en-us.
    > ==================================================
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >

      My System SpecsSystem Spec


Copied file has System and Hidden attribute set.
Similar Threads
Thread Forum
Attrib *.* not removing hidden attribute Vista General
new name of copied file VB Script
"Hidden" attribute Vista General
File Manager doesn't display WHAT file is being copied/moved!?!?!?! Vista file management
Can't unblock an executable copied from another system Vista security