I have an archiving script that uses 7z -tzip -aoa and it runs on unix and works fine. But when run through Autosys, it always fails when trying to archive a second file to an existing archive. The error is:
7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=C,Utf16=off,HugeFiles=on,8 CPUs)
Scanning
Updating archive
20150807.zip
Error:
7-Zip cannot open file
20150807.zip.tmp
Permission denied
It doesn't tell me where it's having permissions with that tmp file, so I don't know where to look. I've set all the permissions to any folders that I thought it might be using to 777, but the problem persists. It works great when not using Autosys.
I found the comment below but it seems to be relevant only to Windows. I'd like to know how I can make this work on UNIX.
I tried to search for a while on the net, but couldn't find any help, so here I am.
My first problem is when I try to compress a folder in C:// with the context menus (7-zip > Add to "xyz.zip"), I get the error : "Access is denied. 7-zip cannot open file "xyz.zip.tmp"
I can however open the file manager in the 7-zip folder ("7zFM"), run as administrator and compress the said file to .zip.
It seems to be a security issue about C:// directory, since it seems that I can compress other files and folders just fine.
Any help?
Link
Shell
Shell
2012-07-29
You have guessed right. You can either 1) run 7-Zip as administrator or 2) set the working directory in 7-Zip File Manager (Tools->Options->Folders) to an unprotected one (for example, clear the checkbox there) and use the "Add to archiveā¦" menu and create the archive in an unprotected directory.
Set the working directory using the -w switch.
7z does not use current directory (the one you get by pwd) as a working directory. It uses the one that the resulting archive is going to be created at.
For example:
/tmp $ 7z a /folder.7z /folder
will ignore the fact you're in /tmp and will first create a tmp file in / and then put the result in the / no matter what you current folder is.
If you don't have access to create files in / but you do have access to update the archive that's already there (a very valid scenario) you're going to get exactly what you get:
/tmp $ 7z a /folder.7z /folder
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i7-7500U CPU # 2.70GHz (806E9),ASM,AES-NI)
Open archive: /folder.7z
--
Path = /folder.7z
Type = 7z
Physical Size = 150
Headers Size = 150
Solid = -
Blocks = 0
Scanning the drive:
1 folder, 2 files, 0 bytes
Updating archive: /folder.7z
Items to compress: 3
Error:
cannot open file
/folder.7z.tmp
Permission denied
System ERROR:
Unknown error -2147024883
Also, in case you're omitting the archive name from the command line, it's going to use directory of your source.
For example, when you do this:
7z a /folder
it is going to use / as a working directory - it will attempt to create temp file in / and will put the resulting archive there as well.
To fix that just make sure that the archive name is in your command line and that you have file create permission to the folder the archive is going to be created (sometimes you have access to update the archive itself but can't create new files in the dame folder)
Related
I'm new to R and RStudio and am currently taking online classes to learn more about data science. In one of my lectures, I'm being asked to create a project in RStudio prior to creating a repository in github and linking the project with git. In order to make a pre-existing project interact with git, the instructions in my lecture are telling me to navigate to the directory containing my project file by using the "cd" command followed by the location of the file and file name. My project file is currently located on my desktop so I typed in "cd ~ /Desktop/temporary_no_version_control" however, the directory doesn't seem to change and remains set on the original location of the file which was in Users/savannahkeiffer. Just so I could complete the assignment, I re-located the file to my user file and tried to follow the rest of the instructions which told me to type "git init" followed by "git add ." which is where I run into the "warning: could not open directory" warning.
I have a macbook which runs on OS X Maverick. I went into my system preferences > security and privacy and selected Full Disk Access where I manually allowed terminal to have access to all the files on my laptop. However, after closing and re-opening RStudio and attempting the commands again, I got the same error.
This is what I entered when I tried to change the directory
Savannahs-MacBook-Air-2:~ savannahkeiffer$ cd ~
/Desktop/temporary_no_version_control
Savannahs-MacBook-Air-2:~ savannahkeiffer$ git init
Reinitialized existing Git repository in
/Users/savannahkeiffer/.git/
And what I got when I changed the location of the project on my laptop in order to complete the assignment (after already giving access to terminal)
Savannahs-MacBook-Air-2:~ savannahkeiffer$ cd ~
/Users/savannahkeiffer/first project/temporary_no_version_control
Savannahs-MacBook-Air-2:~ savannahkeiffer$ git init
Reinitialized existing Git repository in
/Users/savannahkeiffer/.git/
Savannahs-MacBook-Air-2:~ savannahkeiffer$ git add .
warning: could not open directory 'Pictures/Photos
Library.photoslibrary/': Operation not permitted
warning: could not open directory 'Library/Application
Support/MobileSync/': Operation not permitted
warning: could not open directory 'Library/Application
Support/CallHistoryTransactions/': Operation not permitted
warning: could not open directory 'Library/Application
Support/com.apple.TCC/': Operation not permitted
warning: could not open directory 'Library/Application
Support/AddressBook/': Operation not permitted
And so on.. Is this a directory problem or a "git add ." command problem?
It looks like what happened is that when you typed the cd command, you left a space in between the tilde and the rest of the path, so you changed back into your home directory (represented by the tilde). Then, when you tried to do a git init, you tried to initialize your home directory as a Git repository, and then ran into the fact that macOS restricts some programs (in your case, not Terminal, but maybe still Git) from accessing certain directories.
In the shell, the tilde is just a fancy way of spelling the environment variable $HOME, which points to your home directory (in this case, /Users/savannahkeiffer), so it should immediately precede the rest of the path without a space in between.
The best thing to do in this case is switch into your project directory and then initialize a repository there:
cd ~/Desktop/temporary_no_version_control # note the lack of space after the tilde
git init
If you didn't intend for your home directory to be a repository (i.e., you're not storing your dotfiles in a repository there), then you will probably also want to remove the .git directory from your home directory by running rm -fr ~/.git. Be careful when typing this, as rm removes data without prompting and an unfortunate space could result in all your data being deleted.
Hello this was an issue I had also but in Windows. It was a simple fix, user error. I hadn't used gitbash for awhile so I forgot the process with working in gitbash. First mistake I made was after opening gitbash I directly executed the git status command. That's when I got the "warning: could not open the directory" message. You need to using the cd (change directory) command and the dir (directory) command to navigate to the folder that has the files you want to "git add ." and "git commit -m". Once you get to that folder you will be able to use the "git status" command to see your changes then proceed as normal. I had to post this because it took me hours before I realized what I was doing wrong. No other stack post pointed this obvious user mistake. Hope it helps you.
I'm trying to install Grav on Heroku following the learn.getgrav.org docs.
I've got the web app deployed successfully, however it tells me to bin/grav install.
I do that and it gives me the following output:
ERROR Missing .dependencies file in user/ folder
I do not know what to do at this point as it's happened everytime I've installed Grav.
Hope this will be solved.
Sadly this problem is all too common when copying files :(
hidden (dotted) files are not always copied.
.dependencies
.htaccss
using ls -l -a in the folder where you extracted the files originally Dowloads/grav I could see the files that were not copied to fix it
cp .dependencies .htaccss /var/www/grav/
When I install GRAV on my server each time, I always copy the Zip file to the server, unzip it in place, then remove the zip file - using this method I have never had a problem with the installing of GRAV
HTH Rich
Can anyone tell me how to recreate my status.cgi file for nagios. I have a status.dat file that supposedly it is created from. Bonus points if you can tell me how to make a status-json.cgi file also.
I have downloaded the status.c file from nagios 3.5.0 and also the Makefile that was in the same cgi folder. However when I tried copying those to my server and running the command "make status.cgi" I got "no rule to make target 'status'. Stop.
SOLVED:
Recreating just the status.cgi file proved difficult and trivial. What I did to get the file back was this.
I created a copy of my whole /usr/local directory just to have a
backup.
I downloaded the source for a new full install of nagios for the specific version I had installed.
./configure
make all
make install <- this recreates all the cgi files.
I then recopied my original local directory back (changing the name of the one I just made)
Then moved the status.cgi file from the new local directory to the original one (in /usr/local/nagios/sbin)
the status.cgi file is now working again
you need the command:
make install-webconf
That'll recreate the files and drop them where they need to be
I have been using Robocopy to backup my computer files. I have been using the following command:
robocopy C:\Users\ J:\backup\ *.* /a /XD AppData /XJD /R:0 /s
When I look into my J drive in Windows Explorer I see folder named J:\Users\ but when I use dir from the command line I see a folder named j:\backup. The backup and user folder seem to be the same. I also tried looking at the content of the J drive in cygwin and see the backup folder but do not see a Users folder. What is going on? Is robocopy the culprit?
Just go into the backed up folder and delete the desktop.ini file. The folder name will revert back to the directory name. You copied the desktop.ini file from the source "users" folder that is causing the issue. You can and desktop.ini to your exclusions list with out any issues to your back up. They get created on the fly anyway if they are not present.
I tested this on a windows 7 pro machine just to verify.
The problem is not related to robocopy. The link below describes the problem.
https://superuser.com/questions/381110/windows-explorer-sees-different-file-name-from-cmd/381159#381159
Currently I am in my installing directory say c:\Program File\My installer.I have to execute a demo.bat file that is stored at some other location say c:\Program Files\Temp\example.bat,which I have to go at that location and execute coz my example.bat has some support files that are only stored in Temp folder.
My question is how can I change my installing directory to some other directory, execute demo.bat file and come back to my original installing directory while writing an nsis script?
When talking about "installing directory", I assume you mean current/working directory in the context of a batch file.
push $outdir ;save original path
SetOutpath "$programfiles\temp" ;set currect directory
nsExec::Exec "example.bat"
pop $outdir
SetOutpath $outdir ;restore
There are several ways to execute a batch file (Expand %comspec% and pass it to Exec/ExecWait, or use one of the exec plugins (nsExec,ExecDos,ExecCmd))