PYTHON Copy a shortcut even if it already exists
Published: March 28, 2019 - 08:47
Good morning,
In an Open Office package, I need to copy shortcuts to the desktop for all users here: C:\Users\Public\Desktop\Software\
If the file already exists, it displays an error message.
To replace this long line of code, is there a simpler way in Python?
Copy even if the file already exists. I haven't found any help on search engines or the forum
Installed WAPT version (1.5.1.26)
- Server OS (Linux) and version (CentOS 7 - )
- Operating system of the administration/package creation machine (Windows 7 / 10)
In an Open Office package, I need to copy shortcuts to the desktop for all users here: C:\Users\Public\Desktop\Software\
Code: Select all
if os.path.isfile('C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OpenOffice 4.1.5\OpenOffice Calc.lnk'):
remove_file('C:\Users\Public\Desktop\Logiciels\OpenOffice Calc.lnk')
shutil.move('C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OpenOffice 4.1.5\OpenOffice Calc.lnk','C:\Users\Public\Desktop\Logiciels')
print('OpenOffice Calc.lnk deplace')
To replace this long line of code, is there a simpler way in Python?
Copy even if the file already exists. I haven't found any help on search engines or the forum
Installed WAPT version (1.5.1.26)
- Server OS (Linux) and version (CentOS 7 - )
- Operating system of the administration/package creation machine (Windows 7 / 10)