How to write files of the same name to a directory using Python - python-3.x

I would like to write files of the same name to a directory using Python. Like when downloading the same file from a browser.
I have an existing directory containing the files "aaa.py" and "aaa(1).py".
I would like to add several versions of a file named "aa.py".
The resulting directory should contain:
"aaa.py"
"aaa(1).py"
"aa.py"
"aa(1).py"
"aa(2).py"
etc.

Related

How to convert all nodejs files into one executable file

Currently, I'm using pkg module to convert it to a single exe file and it does only one main.js file, but on the root folder, it has multiple *.js files that are needed to run along with this. I want all packages and files to be executed with a single click without exposing the files or installing them on the machine.

List files in a folder, in the parent directory

I know you can list the files of a directory with:
os.listdir('FOLDER_DIR')
But how do i list the files in a folder that exists in a directory above where i am right now?
For example, consider the following folder structure:
----PARENT
-------sub_dir1
-------sub_dir2
If my python program is in sub_dir2, how can i list the contents of folder sub_dir1, without changing directory?
The answer is os.listdir('../sub_dir1')

How do I access the directory of my NSIS Installer inside a Zip File to extract that Zip File?

I want to extract a ZIP File with the .exe inside.
I want to execute the .exe inside the Zip to extract the Zip File.
Already tried it by executing: ZipDLL::extractall "$EXEDIR" "$DESTINATION"
I think that does not work, cause the .exe is stored in the TEMP Folder when opened, so it cannot find the.Zip file
So how do I extract that Zip when executing the .exe from inside the Zip?
Thanks for answers!
Your question does not make a lot of sense, you should just put the files inside the installer and not have a zip file at all.
Even if it made sense, it is not possible because where a exe is executed from when you double click it inside a zip file depends on the zip program you are using and there is no way of getting the path of the zip it was extracted from.
If for some reason you want to be able to update the files inside the zip file without rebuilding the installer you can use a cab file instead. The CabX plug-in supports extracting from cab files appended to the installer exe.

How to include all necessary files and folders in python executable file using pyinstaller on ubuntu?

I want to keep all the python script files hidden and want to give executable file to the user.
Here's the screeenshot of the folder:
I am running it from the webroot directory of a project.I am going to run my project on the local host. In the Al3ViewerController I have given path to the main.py/ exe main file using shell_exec. But I need to keep the folder containing all the other python and DB files and I cannot do that for code security purpose, hence an exe file to run. could be --onefile / folder. I would want to remove that folder completely and just run from the executable file

no such file or directory (cygwin)

I am trying to install a solver (SCIP) with cygwin. After unpacking the folder consists of another 5 folders. The manual says I have to go in folder A and use make. Here, I get the message that one file was not found:
zimpl/bool.h: No such file or directory
This file is in folder B in the path zimpl/src/bool.h. How can I link this file from folder B that cygwin can use it while using make in folder A?
The support says:
Blockquote The error you postet looks like your zimpl softlink is incorrect. If you use a relative path, make sure that it is relative to the position where
the link is created. Most softlinks are created directly in the lib
directory, the zimpl softlink, however, is in a subdirectory of the lib
directory, so you have to go up two directories to get to the main SCIP
directory.
However I am not sure how to check the softlinks.
Thanks!

Resources