Double click .exe file to generate .DAT file in SSIS - ssis

I have a requirement to open the .exe files, which will create .DAT file (contains data) in the same path. When I tried using execute process task and script task to open the .exe file. I can only see the .exe executing but not opening. As a result,.DAT file is not generated. Can you help me how to resolve this? Because executing the .exe file is not what is required. Double-clicking on the file only generates the file.

Related

How to run python (pycharm) files with task scheduler to search for excel files?

I have made a python script to upload new excel files from a folder on google drive. I would like to run this automatically via task scheduler. Unfortunately, running the file via task scheduler results in a different output, namely that the excel file can't be found.
I have done the following: I made a batch file of the python script and that one works fine. Then, I have put the filepath of the batch script under Actions>Program script in the task scheduler. It starts running the python script but can't find the excel files.
The batch file is in the same folder as the python files (which I run with pycharm), but the excel files the script is looking up is located on a (shared) google drive folder.
I have used this code to look up the excel files:
# check if file exists
try:
with open(currentfilepath) as f:
print("File exists: ", currentfilepath)
except FileNotFoundError:
print('File does not exist: ', currentfilepath)
So the problem is: if I run it in pycharm, the output says "File exists:", while when I run it in the task scheduler it gives the output "File does not exist:"
Does anyone know why this happens and how I could solve it?

python3 when saving a file it doesn't save to same directory as the EXE pyinstaller

I have used Pyinstaller to pack my script as onedir EXE, then installed to Program Files folder. i used this line to save a json to a file:
json.dump(data, open("data_file.json",'w'))
on some computers the file saved to where EXE is which is what i want, but others save it to different locations.
so when i try to get the file using json.load it says not file found:
json.load(open("data_file.json"), encoding="utf-8")
How can i solve this issue so the script only save files to the same EXE directory?
The cause of the problem is related to writing permission on windows. so instead of writing app data to the Program Files folder which is not recommended, you need to write the data to APPDATA folder.
i have used the code posted by giuliano-oliveira and it works perfectly cross platform.
get_user_data_dir

SSIS File System Task - Move Directory

I am extremely confused.
I have a destination directory: \\Client\D$\Data Feed\Archive. I set this as my Destination Connection in File System Task Editor.
I have a source directory: \\Client\D$\Data Feed\Plan 24-01-2020. I set this as my Source Connection in File System Task Editor. It also contains one CSV file.
For the Operation in File System Task Editor I choose Move Directory as the Operation.
All setup just click run. When I execute I get the following error message: "Cannot create a file when that file already exists."
Curiously enough the CSV file inside the source folder is copied to the Archive folder.
I was expecting only that the folder Plan 24-01-2020 would be moved to the folder Archive.
What I'm I doing wrong?
Because according to this tutorial the folder should be moved without any issues: https://www.tutorialgateway.org/move-directory-using-file-system-task-in-ssis/
I think there are two things you'll want to do here.
First, create an expression in the File System Task that sets OverwriteDestinationFile to TRUE.
Next, you'll want to slightly modify your Destination path. Instead of just \\Client\D$\Data Feed\Archive\, you'll probably want to specify your destination as \\Client\D$\Data Feed\Archive\Plan 24-01-2020\. Otherwise, it will just copy the contents of \\Client\D$\Data Feed\Plan 24-01-2020\ into \\Client\D$\Data Feed\Archive\ without creating the Plan 24-01-2020 sub-folder.

How to read csv files with beaker notebook?

I use Beaker on Windows and start it up with gitbash with the following command:
./beaker.command.bat
If I want to read a .csv or excel file I have to place it in the same directory as the beaker.command.bat.
How can I just the .csv files directly from their original location where the .bkr notebook script and the files are located?
I figured it out, just use the full directory path instead pointing to the file.

How to seperate out ERROR FILE from Correct file using SSIS and archive them

I have a scenario where there are two source file ABC.txt and DEF.txt. i want to make sure that if any files are present in that folder with naming convention as ABC.txt, it has to be moved to the different folder prior to loading to the SQL server, and the other (incorrect file) should be moved to a error log folder (separate folder). Can someone advice what task would i use to do that. i tried it using File system task but it just allow you to move or copy files from one location to other prior to loading the file.can someone advice how to i copy that incorrect file to the different folder ( error log folder)?
try to use a bat file.
move ABC.txt /directory
and after
xcopy "source" "destination_err\" /exclude:%temp%\ABC.txt /y
or you can use robocopy command in bat file, this is the command with parameters http://itsvista.com/2007/03/robocopy/