getting access to the path denied while saving a zip file using DotNetZip library - asp.net

I am trying to create a zip file and save it using DotNetZip library.
But for some reason i get a "Access to the path is denied" error when i try to save it. Code4 is below
Dim zipFile As New ZipFile()
zipFile.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression
zipFile.AddFile(filePath)
Dim tempFilePath As String = "abc.zip"
zipFile.TempFileFolder = "D:\Company Data\Operations\media\test_folder_cover_scan\"
zipFile.Save(tempFilePath) <== error line
I have given all possible access to the folder. I am using .net 3.5. This whole code works in a web service
Please advise

The backslashes in your TempFileFolder are not escaped which might cause a problem. Try using a verbatim string literal instead.
zipFile.TempFileFolder = #"D:\Company Data\Operations\media\test_folder_cover_scan\"
Also, the tempFilePath in your example doesn't include a full path, could it be that it is trying to save the ZIP into a different folder from the one you are expecting (and have assigned permissions to)?
Have you assigned permissions to both the temporary file folder AND the real destination folder?

It looks like you don't have access to where you are trying to save it to. Try opening the command prompt and typing
takeown /f D:\Company Data\Operations\media\test_folder_cover_scan
That should give you ownership to the folder you are trying to save the file to.

Related

SQL Server Management Studio will not redirect output from command line

I am using SQL Server Agent to run a few scripts regularly of type CmdExec with the following format:
"Absolute path to RScript.exe" "Absolute path to script.R" > "Absolute path to log folder\logfilename.txt"
This line will work when used manually in the command prompt but won't create a log file when executed through SSMS. Anyone else have trouble dealing with SSMS or is there a problem with my line?
What also works (in the sense that a file is created) in SSMS is type nul > "Absolute path to log folder\logfilename.txt" so there is no problem with the file path or write permissions.
Not sure if this piping is possible for "normal" commands, but under Step Properties -> Advanced, you can choose to save output to file

What is the filepath that a "Read CSV" operator needs to read a file from RapidMiner Server?

I have a RM Server running on a VM (Ubuntu) on top of my Win10 machine.
I have a process to read a .csv file and write its contents on a MySQL database on a MySQL Server which also runs on the same VM.
The problem is that the read file operator does not seem to be able to find the file.
Scenario1.
When I try as location-name in the read csv operator ../data/myFile.csv
and run the process on Server I am getting Failed to execute initialization process: Error executing process /apps/myApp/process/task_read_csv_to_db: The file 'java.io.FileNotFoundException: /root/../data/myFile.csv (No such file or directory)' does not exist.
Scenario2.
When I try as location-name in the read csv operator /apps/myApp/data/myFile.csv
and run the process on Server I am getting Failed to execute initialization process: Error executing process /apps/myApp/process/task_read_csv_to_db: The file 'java.io.FileNotFoundException: /apps/myApp/data/myFile.csv (No such file or directory)' does not exist.
What is the right filepath that I should give to the Read CSV operator?
Just to update with the answer. After David's suggestion, I resulted in storing the .csv file outside of the /rapidminer-server-home/data/repository since every remote repository seems to be depicted with an integer instead of its original name, making the use of the actual full path of the file not usable.
I would say, the issue is that depending on the location of the JobAgent that is executing your process, the relative path might be varying.
Is /apps/myApp/data/myFile.csv the correct path to the file? If not, I would suggest to use the absolute path to the file. Hope this helps.
Best,
David

Delete files from SFTP using R Studio

I need to delete files from an FTP site once I have processed them in R (parsing content). However, nothing I try seems to work.
this is what ive trying, and variations of.
library(RCurl)
curlPerform(url="sftp://user:password#sftplocation/folder/", quote="DELE filename.pdf")
curlPerform(url="ftp://xxx.xxx.xxx.xxx/", quote="DELE file.txt", userpwd = "user:pass")
Error is
Error in function (type, msg, asError = TRUE) : Unknown SFTP command
When I run the following code, I get a lovely list of all the files (which is used to download them). So I know the connection is working just great, and the parsing from the downloaded files works great!
curlPerform(url="sftp://user:password#sftplocation/folder/")
Thanks,
Siobhan
To delete over sftp, use rm instead of DELE - which looks like an ftp rather than an sftp command.
Then make sure you have the full file path. This works for me:
curlPerform(
url="sftp://me#host.example.com/",
.opts=list(
ssh.public.keyfile=pub,
ssh.private.keyfile=pri),
verbose=TRUE,
quote="rm /home/me/test/test.txt")
Note I've put my credentials in some key files so I don't put the password in plain text in the code.
I'm not convinced this is the best way to do it, since I can't stop it printing the contents of the URL... There's might be an option...

R: source() not calling file name but is calling working director url

I have a script saved on working directory "C:Users/u338499/Desktop/r". The file name is "test.R". getwd() will return exactly the URL above.
On the console, when I call the script using the full URL (ie source("C:Users/u338499/Desktop/r/test.r")), the script runs successfully. However, when I call it using just the file name "source(test.R)" or "source(test.r)", it says "Error in source(test.R) : object 'test.R' not found."
Anyone know why calling the source method using just the file name is not working? (note as above, my working directory is set to the 'r' folder and I definitely have the test.r file in there).

PHPExcel exception: "Could not close zip file ... "

I am using XAMPP a Mac for local development, but I used this code at work (using Windows and an otherwise identical development environment) and it worked fine:
$objPHPExcel = new PHPExcel();
$sheet = $objPHPExcel->createSheet();
$sheet->fromArray($a);
...
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
//$objWriter->save('P:/Projects/Mess3/Sadness.xlsx');
$objWriter->save('/Users/tjb1982/Desktop/sadness.xlsx');
The commented-out text works with my Windows system at work. I tried to output the file to 'php://output' and got a garbled mess (is that what is to be expected?).
I can't seem to find anyone who is experiencing this problem outside of those who had permissions problems or had the file open when they were trying to save it. Please help!
I was getting the same error "Cannot close zip file.." and realized it didn't have permissions to write to that directory. Check your write permissions. (IIS8 + php + mysql + oracle)
Once i allowed write permissions problem was immediately fixed.
Generally this means one of 3 things:
The directory where you're trying to save the file doesn't exist
The directory/file has permissions that preclude you from writing to it
The file is already open in some other application, or has a lock on it
I had the same problem, just added the path in the save method and it worked
$objWriter->save(dirname(FILE)."dir1"."/".$file.".xlsx");
I found that this problem is caused when you execute the code once and then open the outputted excel file with Office excel. Try closing the file in excel and then try! Hope this helps!
I had the same problem, actually you have to modify the basic rights of reading and writing given to your PHPWord directory:
chmod -R 777 PHPWord/

Resources