What is Temp-File scheme used during backup or sync?


TheMystic

Well-known member
Power User
VIP
Local time
5:04 AM
Posts
696
OS
Windows 11
Hello community!

I use 3rd party apps to backup files from my mobile devices to my laptop.

For this, I sign in with a user account that is setup in Windows only for this purpose.

Now this account is only allowed the following permissions:

20211119_151454.png

I prefer not to allow 'Modify' permission to block these 3rd party apps from other devices from (accidentally or otherwise) deleting files on my laptop.

By default, all 3rd party apps use 'Temp-File' scheme to backup files, which in my understanding allows them to create a temp file during the file transfer process, and once the transfer is complete, the temp file is deleted. So for them to use this method, the target (or destination) directory should allow for 'Modify' permission (something I don't want to give). If this permission is not available, one has to disable the use of 'temp-file' scheme and instead use 'write directly to target folder' method.

1. Why do apps use the 'temp-file' method by default? Does it make file transfers more reliable and faster?
2. What are the disadvantages of using the 'write directly to target folder' method? Does this increase the chance of files getting corrupt during the transfer?


Thanks.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Envy dv7
    CPU
    Intel Core i7 3630QM
    Motherboard
    HP
    Memory
    16 GB
    Graphics Card(s)
    Intel HD Graphics 4000 & Nvidia GeForce GT 635M
    Sound Card
    IDT High Definition
    Screen Resolution
    1080p
    Hard Drives
    1 TB Crucial MX500 on bay 1.
    1 TB Seagate HDD on bay 2.
    Antivirus
    Windows Defender

barman58

Moderator
Staff member
Local time
12:34 AM
Posts
1,094
OS
Windows 10 Pro x64 [Latest Release Preview]
The temp file method has been used in computing for many years, probably since backups were first used. It is also used by the OS itself for a file move

What it allows for in for the backup software is that they can safely test the file for accurate copying without risk of damage to the original
the system will make a local copy, compare to the original and then move/copy the copy to the backup media.

With a general move operation the system makes a copy of the original and moves that to the new location and compares the copy with the original - only when this is complete without errors is the original deleted

In windows the temp file will often be renamed by adding a special character to the base filename Eg the file "File1.txt" will be copied to the temp file "$File1$.txt - you can sometimes find this type of file on a disk after a glitch occurs with the process
 

My Computers

System One System Two

  • OS
    Windows 10 Pro x64 [Latest Release Preview]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Chillblast to my design
    CPU
    Ryzen 9 5950X, 4.9GHz
    Motherboard
    Asus Prime X570-Pro Motherboard
    Memory
    64GB DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti - HDMI, DP
    Sound Card
    On motherboard Feeding SPDiF 5.1 system
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Chillblast Silent Workstation PC Case - Black
    Cooling
    NZXT Kraken X63 280mm CPU Cooler, Quiet Case fans Fan
    Keyboard
    Wireless Logitec MX Keys + K830 [Depending on where I'm Sat]
    Mouse
    Wireless Logitec - MX Master 3 + M570 Trackball
    Internet Speed
    72 MB Down 18.5 MB Up
    Browser
    Latest Chrome
    Antivirus
    BitDefender Total Security 2021
    Other Info
    Also run...
    Laptop - Quad 8GB - Windows 10 Pro x64 HP 15.2"
    Nexus 7 Android tablet [x2]
    Samsung 10.2" tablet
    Blackview 10.2 Tablet
    Sony Z3 Android Smartphone
    Samsung S9 Plus Smartphone
    Samsung Note S20
    Wacom Pro Medium Pen Pad
    Wacom Pro Small Pen Pad
    Wacom ExpressKey Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
  • Operating System
    Windows 10 Pro x64 [Latest release]
    Computer type
    Laptop
    Manufacturer/Model
    Dell XPS 17 9700
    CPU
    i7 10750H
    Motherboard
    Stock
    Memory
    32 GB
    Graphics card(s)
    Stock Intel + GTX 1650 Ti
    Sound Card
    Stock 4 speaker
    Monitor(s) Displays
    Stock 17"
    Screen Resolution
    3840 x 2160 HDR touchscreen
    Hard Drives
    2TB M2 NVMe
    PSU
    Stock
    Case
    Stock Aluminium / Carbon Fibre
    Cooling
    Stock + 2 fan cooling pad
    Mouse
    Stock Trackpad +Logi Mx Master 3
    Keyboard
    Stock Illuminated + Logi - MX Keys
    Internet Speed
    72 MB Down 18.5 MB Up
    Browser
    Latest Chrome
    Antivirus
    BitDefender Total Security 2021

TheMystic

Well-known member
Power User
VIP
Thread Starter
Local time
5:04 AM
Posts
696
OS
Windows 11
The temp file method has been used in computing for many years, probably since backups were first used. It is also used by the OS itself for a file move

What it allows for in for the backup software is that they can safely test the file for accurate copying without risk of damage to the original
the system will make a local copy, compare to the original and then move/copy the copy to the backup media.

With a general move operation the system makes a copy of the original and moves that to the new location and compares the copy with the original - only when this is complete without errors is the original deleted

In windows the temp file will often be renamed by adding a special character to the base filename Eg the file "File1.txt" will be copied to the tamp file "$File1$.txt - you can sometimes find this type of file on a disk after a glitch occurs with the process
A backup operation is essentially just a copy operation (unless the user sets it to delete source files after copying), so is there still a risk of damage to source files?

I see that the apps can still backup my files in the mobile devices to my laptop without the 'Modify' permission. But I am not sure about the disadvantages of using this method.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Envy dv7
    CPU
    Intel Core i7 3630QM
    Motherboard
    HP
    Memory
    16 GB
    Graphics Card(s)
    Intel HD Graphics 4000 & Nvidia GeForce GT 635M
    Sound Card
    IDT High Definition
    Screen Resolution
    1080p
    Hard Drives
    1 TB Crucial MX500 on bay 1.
    1 TB Seagate HDD on bay 2.
    Antivirus
    Windows Defender

barman58

Moderator
Staff member
Local time
12:34 AM
Posts
1,094
OS
Windows 10 Pro x64 [Latest Release Preview]
It's always been better policy to work on a copy rather than the original, whilst modern hardware is more reliable and is therefore less likely to cause corruption, it's still safer to use the temp file option

This is doubly important when there is either compression or encryption, or both involved
 

My Computers

System One System Two

  • OS
    Windows 10 Pro x64 [Latest Release Preview]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Chillblast to my design
    CPU
    Ryzen 9 5950X, 4.9GHz
    Motherboard
    Asus Prime X570-Pro Motherboard
    Memory
    64GB DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti - HDMI, DP
    Sound Card
    On motherboard Feeding SPDiF 5.1 system
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Chillblast Silent Workstation PC Case - Black
    Cooling
    NZXT Kraken X63 280mm CPU Cooler, Quiet Case fans Fan
    Keyboard
    Wireless Logitec MX Keys + K830 [Depending on where I'm Sat]
    Mouse
    Wireless Logitec - MX Master 3 + M570 Trackball
    Internet Speed
    72 MB Down 18.5 MB Up
    Browser
    Latest Chrome
    Antivirus
    BitDefender Total Security 2021
    Other Info
    Also run...
    Laptop - Quad 8GB - Windows 10 Pro x64 HP 15.2"
    Nexus 7 Android tablet [x2]
    Samsung 10.2" tablet
    Blackview 10.2 Tablet
    Sony Z3 Android Smartphone
    Samsung S9 Plus Smartphone
    Samsung Note S20
    Wacom Pro Medium Pen Pad
    Wacom Pro Small Pen Pad
    Wacom ExpressKey Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
  • Operating System
    Windows 10 Pro x64 [Latest release]
    Computer type
    Laptop
    Manufacturer/Model
    Dell XPS 17 9700
    CPU
    i7 10750H
    Motherboard
    Stock
    Memory
    32 GB
    Graphics card(s)
    Stock Intel + GTX 1650 Ti
    Sound Card
    Stock 4 speaker
    Monitor(s) Displays
    Stock 17"
    Screen Resolution
    3840 x 2160 HDR touchscreen
    Hard Drives
    2TB M2 NVMe
    PSU
    Stock
    Case
    Stock Aluminium / Carbon Fibre
    Cooling
    Stock + 2 fan cooling pad
    Mouse
    Stock Trackpad +Logi Mx Master 3
    Keyboard
    Stock Illuminated + Logi - MX Keys
    Internet Speed
    72 MB Down 18.5 MB Up
    Browser
    Latest Chrome
    Antivirus
    BitDefender Total Security 2021

TheMystic

Well-known member
Power User
VIP
Thread Starter
Local time
5:04 AM
Posts
696
OS
Windows 11
It's always been better policy to work on a copy rather than the original, whilst modern hardware is more reliable and is therefore less likely to cause corruption, it's still safer to use the temp file option

This is doubly important when there is either compression or encryption, or both involved
In my case, the temp file is created in the destination folder, not local. Also, it is a simple copy operation which does not involve deleting the source files (like in a normal backup operation).

But now after I removed the 'Modify' permission from the destination folder and changed the backup operation to 'write directly to target' option, I don't see the temp file getting created in the destination folder. The source files are still backed up to the destination without errors.

Whether the app will use 'temp-file' scheme or not depends on the permissions for the destination folder. In my case since I have denied 'Modify' permission, it can't use the temp-file scheme since it won't be able to delete the temp file after the backup operation is complete.

From what you say, the app should still be able to create a local copy (in the source folder) which will then be copied/ moved to the destination, before the newly created copy in the source folder is deleted. This is not what is happening with the temp-file scheme.

Since by default all apps use the 'temp-file' scheme (where the temp file is created in the destination folder), I believe there should be some advantage to it over writing directly to the target. But it is not clear what that is.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Envy dv7
    CPU
    Intel Core i7 3630QM
    Motherboard
    HP
    Memory
    16 GB
    Graphics Card(s)
    Intel HD Graphics 4000 & Nvidia GeForce GT 635M
    Sound Card
    IDT High Definition
    Screen Resolution
    1080p
    Hard Drives
    1 TB Crucial MX500 on bay 1.
    1 TB Seagate HDD on bay 2.
    Antivirus
    Windows Defender

barman58

Moderator
Staff member
Local time
12:34 AM
Posts
1,094
OS
Windows 10 Pro x64 [Latest Release Preview]
The only time that the Temp file becomes important is when the system has an issue that causes the direct file write to fail, this would be a small risk with modern hardware as long as you are happy with the risk that's fine
 

My Computers

System One System Two

  • OS
    Windows 10 Pro x64 [Latest Release Preview]
    Computer type
    PC/Desktop
    Manufacturer/Model
    Chillblast to my design
    CPU
    Ryzen 9 5950X, 4.9GHz
    Motherboard
    Asus Prime X570-Pro Motherboard
    Memory
    64GB DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti - HDMI, DP
    Sound Card
    On motherboard Feeding SPDiF 5.1 system
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Chillblast Silent Workstation PC Case - Black
    Cooling
    NZXT Kraken X63 280mm CPU Cooler, Quiet Case fans Fan
    Keyboard
    Wireless Logitec MX Keys + K830 [Depending on where I'm Sat]
    Mouse
    Wireless Logitec - MX Master 3 + M570 Trackball
    Internet Speed
    72 MB Down 18.5 MB Up
    Browser
    Latest Chrome
    Antivirus
    BitDefender Total Security 2021
    Other Info
    Also run...
    Laptop - Quad 8GB - Windows 10 Pro x64 HP 15.2"
    Nexus 7 Android tablet [x2]
    Samsung 10.2" tablet
    Blackview 10.2 Tablet
    Sony Z3 Android Smartphone
    Samsung S9 Plus Smartphone
    Samsung Note S20
    Wacom Pro Medium Pen Pad
    Wacom Pro Small Pen Pad
    Wacom ExpressKey Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
  • Operating System
    Windows 10 Pro x64 [Latest release]
    Computer type
    Laptop
    Manufacturer/Model
    Dell XPS 17 9700
    CPU
    i7 10750H
    Motherboard
    Stock
    Memory
    32 GB
    Graphics card(s)
    Stock Intel + GTX 1650 Ti
    Sound Card
    Stock 4 speaker
    Monitor(s) Displays
    Stock 17"
    Screen Resolution
    3840 x 2160 HDR touchscreen
    Hard Drives
    2TB M2 NVMe
    PSU
    Stock
    Case
    Stock Aluminium / Carbon Fibre
    Cooling
    Stock + 2 fan cooling pad
    Mouse
    Stock Trackpad +Logi Mx Master 3
    Keyboard
    Stock Illuminated + Logi - MX Keys
    Internet Speed
    72 MB Down 18.5 MB Up
    Browser
    Latest Chrome
    Antivirus
    BitDefender Total Security 2021
Top Bottom