diff --git a/file_utils/unln.py b/file_utils/unln.py index 3567094..c11a091 100755 --- a/file_utils/unln.py +++ b/file_utils/unln.py @@ -129,6 +129,11 @@ for filename in sys.argv[1:]: verbose("Copying to temporary file", quote(tmpfilename), end="... ") shutil.copy2(filename, tmpfilename) # cp -p + # Try to sync if we are running Python >= 3.3 + if sys.version_info.minor >= 3: + verbose("Syncing", end="... ") + os.sync() + # Rename the temporary file with the original file name verbose("Moving back {} to {}...".format( quote(tmpfilename), quote(filename)))