Follow

Unable to Sync files to Syncplicity due to Temporary File Attribute issue on Windows machine.

What are Temporary Files in Windows?

When Windows carries out certain tasks, it creates temporary files. These tasks include Web browsing in Internet Explorer and unpacking archived files, for example, during software installation. Certain software applications use temporary files to store versions of documents during editing. These files are typically deleted when editing is complete. Windows uses different locations to store these temporary files, which are often only kept for a short period of time.

Is Syncplicity marking files as temporary file in Windows OS?

Syncplicity by design does not sync files with temporary attributes and Syncplicity is not putting those temporary attributes on those files.

Symptoms: Unable to add files to Syncplicity and Syncplicity logs indicates files are being ignored since they are temporary file.

Example of the log files:

2015-06-18T00:53:53 DEBUG [io] Scanner - Scanning C:\Test
2015-06-18T00:53:53 INFO [io] Scanner - Ignoring C:\Test\test.docx because File is a temporary file.

Steps to reproduce the issue:

The following Powershell and Syncplicity debug mode windows need to be opened while testing the issue.

>> Open Powershell in windows >> Click on start menu >> type Powershell >> Right click on "Windows Powershell" >> Run as administrator
>> Open Syncplicity debug mode window >> press ctrl button + Right click on Syncplicity icon >> Syncplicity Trace window will be opened.

1. Create a folder Test under C drive
PS C:\Test> pwd
Path
----
C:\Test

2. Create a file and add some data in the file.
PS C:\Test> ls
   Directory: C:\Test
Mode               LastWriteTime     Length Name
----               -------------     ------ ----
-a---         6/18/2015   1:40 AM     14160 test.docx
PS C:\Test>

3. Checking the Temporary Attribute on a File using Fsutil >> run this command in powershell
 
PS C:\Test> fsutil usn readdata c:\test\test.docx

Major Version   : 0x2
Minor Version   : 0x0
FileRef#         : 0x0004000000065bef
Parent FileRef# : 0x0006000000065000
Usn             : 0x00000000e9011b98
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info     : 0x0
Security Id     : 0x0
File Attributes : 0x20
File Name Length : 0x12
File Name Offset : 0x3c
FileName         : test.docx
PS C:\Test>

File Attributes is a bitmask that indicates which attributes are set. In the above example, 0x20 indicates the ARCHIVE attribute.

Here are the possible values:
 
READONLY                          0x1
HIDDEN                              0x2
SYSTEM                              0x4
DIRECTORY                         0x10
ARCHIVE                             0x20
DEVICE                               0x40
NORMAL                              0x80
TEMPORARY                       0x100
SPARSE_FILE                       0x200
REPARSE_POINT                  0x400
COMPRESSED                      0x800
OFFLINE                              0x1000
NOT_CONTENT_INDEXED      0x2000
ENCRYPTED                         0x4000

4. Let’s apply temporary attributes to test.docx using below command on Powershell.
PS C:\Test> pwd
Path
----
C:\Test
test.docx file attributes before running the command.
PS C:\Test> attrib
A           C:\Test\test.docx

PS C:\Test> Get-Item c:\test\*.docx | foreach {$_.Attributes = 'Temporary'}  
 

test.docx file attributes before running the command
 PS C:\Test> attrib
             C:\Test\test.docx

5. Now when we check the test.docx file attributes we can notice it has a value of 0x100 which mean the file has been marked as temporary file.

PS C:\Test> fsutil usn readdata c:\test\test.docx

Major Version   : 0x2
Minor Version   : 0x0
FileRef#         : 0x0004000000065bef
Parent FileRef# : 0x0006000000065000
Usn             : 0x00000000e901cab0
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info     : 0x0
Security Id     : 0x0
File Attributes : 0x100
File Name Length : 0x12
File Name Offset : 0x3c
FileName         : test.docx
PS C:\Test>

6. Now add the test folder to Syncplicity and exclude (select the option "only this file") and include the test.docx file, now we can see the below error code in Syncplicity Trace window or Syncplicity.log file.

2015-06-18T01:53:38 INFO [io] BaseWatcher`1 - Adding: C:\test\
2015-06-18T01:53:38 DEBUG [59] Session - GetNewsFeed
2015-06-18T01:53:39 INFO [io] Scanner - Scanner started with 1 folders and 0 files to scan
2015-06-18T01:53:39 DEBUG [io] Scanner - Scanning C:\test
2015-06-18T01:53:39 INFO [io] Scanner - Scanning 2 items ran in 15.0015 milliseconds
2015-06-18T01:54:00 DEBUG [59] Session - GetStorageEndpoints
2015-06-18T01:54:00 DEBUG [io] Session - GetSyncPoints
2015-06-18T01:54:00 DEBUG [34] Session - GetQuotas
2015-06-18T01:54:02 INFO [io] SyncPointSet - Got 38 SyncPoints (0 added, 0 deleted, 1 modified)
2015-06-18T01:54:02 INFO [io] SyncPointSet - Modified syncpoint test (3824757)
                Permission changed from None to ReadWrite
                OwnerCompanyId changed from 00000000-0000-0000-0000-000000000000 to bdf649f2-b36e-48f7-b833-f6aaf621172c
                OnerCompanyName changed from to EMC IIG
                ResharingPolicy changed from Unknown to AllowAll
                ShareLinkPolicy changed from Unknown to AllowAll
                StoragePasswordComplexityPolicy changed from Unknown to Enabled
                PasswordComplexityOptions changed from Unknown to Lower, Upper
                PasswordComplexityOptionsMinimumLength changed from 0 to 8
                SareLinkExpirationPolicy changed from Unknown to Disabled
                ShareLinkExpireInDays changed from 0 to 6
                RemoteWipeSyncpointPolicy changed from Unknown to Disabled
2015-06-18T01:54:02 DEBUG [58] Session - GetNewsFeed
2015-06-18T01:54:02 DEBUG [59] DownloadController - Skipping GetDownloadList, Scan: 1 directories, 0 files, Hash: 0, UploadChecker: 0, Submit: 0 files and 0 directories; Download queue length: 0
2015-06-18T01:54:02 INFO [io] Scanner - Scanner started with 1 folders and 0 files to scan
2015-06-18T01:54:02 DEBUG [io] Scanner - Scanning C:\test
2015-06-18T01:54:02 INFO [io] Scanner - Scanning 2 items ran in 12.0012 milliseconds
2015-06-18T01:54:12 DEBUG [ 7] Session - GetDownloadList
2015-06-18T01:54:12 INFO [ 7] DownloadController - Download List: 0 folders to delete, 0 files to delete, 0/0 files to download
2015-06-18T01:57:31 INFO [ 1] ExclusionSet - Added exclusion: [FileExclusion] (1) for c:\test\test.docx
2015-06-18T01:57:38 INFO [AutomationListener] ExclusionSet - Removed exclusion(s): [FileExclusion] (1) for c:\test\test.docx
2015-06-18T01:57:38 INFO [io] Scanner - Scanner started with 0 folders and 1 files to scan
2015-06-18T01:57:38 INFO [io] Scanner - Ignoring C:\test\test.docx because File is a temporary file
2015-06-18T01:57:38 INFO [io] Scanner - Scanning 1 items ran in 8.0008 milliseconds
 

Fix :

1. Please run the below command on power shell window with administrator rights.

The following fix is for Single file i.e. test.docx

Get-Item c:\test\*.docx | foreach {$_.Attributes = 'Normal'}  
PS C:\Test> pwd
Path
----
C:\Test
PS C:\Test> ls
   Directory: C:\Test
Mode               LastWriteTime     Length Name
----               -------------     ------ ----
-----         6/18/2015   1:40 AM     14160 test.docx
The following command replaces the Temporary Attribute of a file with Normal Attribute.
PS C:\Test> Get-Item c:\test\*.docx | foreach {$_.Attributes = 'Normal'}
PS C:\Test> attrib
             C:\Test\test.docx

2. Now we should notice the File Attributes value for test.docx indicates a value of 0x80 which means it is a Normal Attribute file.


PS C:\Test> fsutil usn readdata c:\test\test.docx
Major Version   : 0x2
Minor Version   : 0x0
FileRef#         : 0x0004000000065bef
Parent FileRef# : 0x0006000000065000
Usn             : 0x00000000e904e3d0
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info     : 0x0
Security Id     : 0x0
File Attributes : 0x80
File Name Length : 0x12
File Name Offset : 0x3c
FileName         : test.docx
PS C:\Test>

3. Now Just exclude (select the option "only this file") and include the test.docx file now it should be uploaded to Syncplicity.

The following can be noticed in Syncplicity log files.

2015-06-18T02:09:56 INFO [ 1] ExclusionSet - Added exclusion: [FileExclusion] (1) for c:\test\test.docx
2015-06-18T02:10:00 INFO [AutomationListener] ExclusionSet - Removed exclusion(s): [FileExclusion] (1) for c:\test\test.docx
2015-06-18T02:10:00 INFO [io] Scanner - Scanner started with 0 folders and 1 files to scan
2015-06-18T02:10:00 INFO [io] Scanner - Detected created file: C:\test\test.docx
2015-06-18T02:10:00 INFO [io] Scanner - Scanning 1 items ran in 176.0176 milliseconds
2015-06-18T02:10:00 INFO [ h] Hasher - Hashing: C:\test\test.docx, length: 14160, LastWriteTimeUtc: 06/17/2015 20:10:12, SyncState: Added_NeedsHash
2015-06-18T02:10:00 INFO [ h] Hasher - Hashing complete: C:\test\test.docx, f75722eb2ef5e45dd17d4725ab8b20d07d9c8201adb8710fd7943ac80ae8147d_14160
2015-06-18T02:10:01 INFO [io] Hasher - C:\test\test.docx: updated; new SyncState: Added
2015-06-18T02:10:01 DEBUG [44] UploadChecker - Checking 1 files:
              C:\test\test.docx
2015-06-18T02:10:01 DEBUG [44] Session - PostGlobalFiles
2015-06-18T02:10:01 INFO [io] Scanner - Scanner started with 0 folders and 1 files to scan
2015-06-18T02:10:01 INFO [io] Scanner - Scanning 1 items ran in 5.0005 milliseconds
2015-06-18T02:10:02 INFO [44] UploadChecker - UploadChecker results:
                uploading C:\test\test.docx to storage endpoint ID 11111111-1111-1111-1111-111111111111
2015-06-18T02:10:02 DEBUG [44] Uploader - Queueing hash f75722eb2ef5e45dd17d4725ab8b20d07d9c8201adb8710fd7943ac80ae8147d for upload to 11111111-1111-1111-1111-111111111111
2015-06-18T02:10:02 DEBUG [u1] Uploader - Starting thread
2015-06-18T02:10:02 INFO [u1] Uploader - Uploading: C:\test\test.docx, ETag: , Start: 0, Url: https://data.syncplicity.com/saveFile.php?filepath=%5Ctest.docx
2015-06-18T02:10:05 DEBUG [u1] UploadRequestAdapter - Waiting for response
2015-06-18T02:10:06 DEBUG [u1] Uploader - Storing completed upload: C:\test\test.docx
2015-06-18T02:10:07 INFO [u1] Uploader - Uploaded: C:\test\test.docx in 4901.4901 milliseconds
2015-06-18T02:10:07 DEBUG [u1] Uploader - Ending thread

If you have many files and folder you may also use Get-ChildItem with param -Recurse to get recursively item.

PS C:\Test> Get-ChildItem c:\test\* -Recurse | foreach {$_.Attributes = 'Normal'}

PS C:\> cd test
PS C:\test> ls
   Directory: C:\test
Mode               LastWriteTime     Length Name
----               -------------     ------ ----
d----         6/18/2015   2:13 AM           test2
-----         6/18/2015   1:40 AM     14160 test.docx

PS C:\test> cd test2
PS C:\test\test2> ls
Directory: C:\test\test2
Mode               LastWriteTime     Length Name
----               -------------     ------ ----
d----         6/18/2015   2:13 AM           test3
-a---         6/18/2015   1:40 AM     14160 test2.docx

PS C:\test\test2> cd test3
PS C:\test\test2\test3> ls
   Directory: C:\test\test2\test3
Mode               LastWriteTime     Length Name
----               -------------     ------ ----
-a---         6/18/2015   1:40 AM     14160 test3.docx

PS C:\test\test2\test3>

We have ran the below command to update Temporary Attribute to test folder and its sub folder.

PS C:\test> Get-ChildItem c:\test\* -recurse | foreach {$_.Attributes = 'Temporary'}
PS C:\test>
PS C:\test>

We can notice all test.docx, test2.docx & test3.docx file attributes changed to Temporary i.e 0x100.

PS C:\test> fsutil usn readdata c:\test\test.docx

Major Version   : 0x2
Minor Version   : 0x0
FileRef#         : 0x0004000000065bef
Parent FileRef# : 0x0006000000065000
Usn             : 0x00000000e9098130
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info     : 0x0
Security Id     : 0x0
File Attributes : 0x100
File Name Length : 0x12
File Name Offset : 0x3c
FileName         : test.docx

PS C:\test> fsutil usn readdata c:\test\test2\test2.docx

Major Version   : 0x2
Minor Version   : 0x0
FileRef#         : 0x0004000000065cd3
Parent FileRef# : 0x0003000000065ce5
Usn             : 0x00000000e90981d0
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info     : 0x0
Security Id     : 0x0
File Attributes : 0x100
File Name Length : 0x14
File Name Offset : 0x3c
FileName         : test2.docx
PS C:\test>
PS C:\test> fsutil usn readdata c:\test\test2\test3\test3.docx


Major Version   : 0x2
Minor Version   : 0x0
FileRef#         : 0x0002000000065d4e
Parent FileRef# : 0x0001000000065d53
Usn             : 0x00000000e9098270
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info     : 0x0
Security Id     : 0x0
File Attributes : 0x100
File Name Length : 0x14
File Name Offset : 0x3c
FileName         : test3.docx
PS C:\test>

To fix the above Temporary Attribute in a folder and it's subfolder we need to run the below command in Powershell with administrator rights.

Get-ChildItem c:\test\* -recurse | foreach {$_.Attributes = 'Normal'}

We have ran the below command for test folder and its sub folder, after this the top level folder needs to be removed from sync and then add the top level folder back to sync to make the sync work in Syncplicity.

i.e. Right click on syncplicity icon on windows machine >> click on "Manage folders" >> select the test (top level folder) >> click on "Stop Synchronization" >> Now again select the test folder >> Click on "Sync to this computer".

PS C:\test> Get-ChildItem c:\test\* -recurse | foreach {$_.Attributes = 'Normal'}
PS C:\test>

We can notice all test.docx, test2.docx & test3.docx file attributes changed to Normal i.e 0x80.

PS C:\test>
PS C:\test> fsutil usn readdata c:\test\test.docx

Major Version   : 0x2
Minor Version   : 0x0
FileRef#         : 0x0004000000065bef
Parent FileRef# : 0x0006000000065000
Usn             : 0x00000000e90be740
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info     : 0x0
Security Id     : 0x0
File Attributes : 0x80
File Name Length : 0x12
File Name Offset : 0x3c
FileName         : test.docx

PS C:\test> fsutil usn readdata c:\test\test2\test2.docx

Major Version    : 0x2
Minor Version    : 0x0
FileRef#         : 0x0004000000065cd3
Parent FileRef#  : 0x0003000000065ce5
Usn              : 0x00000000e912b500
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info      : 0x0
Security Id      : 0x0
File Attributes  : 0x80
File Name Length : 0x14
File Name Offset : 0x3c
FileName         : test2.docx
PS C:\test> fsutil usn readdata c:\test\test2\test3\test3.docx

Major Version    : 0x2
Minor Version    : 0x0
FileRef#         : 0x0002000000065d4e
Parent FileRef#  : 0x0001000000065d53
Usn              : 0x00000000e912b5a0
Time Stamp       : 0x0000000000000000 12:00:00 AM 1/1/1601
Reason           : 0x0
Source Info      : 0x0
Security Id      : 0x0
File Attributes  : 0x80
File Name Length : 0x14
File Name Offset : 0x3c
FileName         : test3.docx

 

Note: The mentioned fix can be used to fix any file types which has temp file issue.

Powered by Zendesk