How can I access hidden system files with R? - r

I am Mac User. Whenever I want to access Mail folder located in the /Users/user_name/Library/Mail folder; RStudio just ignores it and doesn't show any files.
setwd("/Users/user_name/Library/Mail")`
list.dirs("/Users/user_name/Library/Mail")
> character(0)
list.files("/Users/user_name/Library/Mail")
> character(0)
I understand that because of access to these files requires admin authorization, the R cannot access them. Is there a way to grant admin access to R to access hidden system files?
This question is cross-posted on RStudio Community forum two days ago. Unfortunately, I couldn't get a reply. That's why I asked here again.
Edit: Both of list.files() and list.dirs() return nothing.

Add both the R executable and RStudio executable (drag their icons) to the Full Disk Access element under the Privacy tab of System Preferences => Security & Privacy:
NOTE: I also have R and Rscript in there but the pane is too small to show them.
Also NOTE that I do see
nw_path_close_fd Failed to close guarded necp fd 22 [9: Bad file descriptor]
in the Console.app on these attempts and my call to list.dirs() appears to hang but it's just taking a while b/c I have a ton of folders/files under there (thanks, gmail).
I'd try it incrementally with recursive=FALSE in list.dirs() until you've verified everything is working.
This post has some links that provide background on this new sandboxed filesystem behaviour.

Related

Can i hide .laccdb files or change its name with MS Access settings

Title says it simply.
I have a MS Access Database on a shared drive and the majority of users aren't experts so quite often the leave their PC with the Database open then it locks the PC, someone else will come along and switch it to their account, go to open the Database and get confused by the two files with the same name.
I can think of solutions for this e.g. using shortcuts so they dont actually see the laccdb or accdb file
But what I want to know is if there are any settings in Access (2010) that can make the .laccdb file hidden when it is created or just give it a random name like word or excel tmp files?
When I google this the results are more for removing people from the database so you can delete the laccdb file
This is actually a multi-user setup even though just one user can be active.
So you need to distribute the frontend to each user while having the backend in a folder with access for all users - that could be a subfolder of C:\Users\Public.
Here's is a script that will handle the distribution:
Deploy and update a Microsoft Access application in a Citrix environment

How do you list the files in your home directory in RCloud (http://rcloud.social)?

I uploaded a file in RCloud (http://rcloud.social) using the File Upload GUI in the right panel. It was successfully uploaded since if I try to upload it again by clicking on the blue upload button I get the message: "File blahblah.txt exists. OVERWRITE".
How do I see what files are listed in my home directory?
I tried ls in a shell cell and list.files(R.home()) in an R shell.
The question asks two different questions - uploaded file are stored in the rcloud.upload.path() directory, so you would list files in that path using
list.files(rcloud.upload.path())
The second question was about the home directory (which is not directly related to upload!). That is also ambiguous since the unix user directory may or may not coincide with the RCloud home directory - that depends on the deployment (e.g. whether each RCloud user maps to an actual unix user or not). The RCloud home can be queried using rcloud.home() while unix home would be simply "~". Also note that rcloud.home() can be used to query other user's home as well (see documentation).
Finally, both rcloud.home() and rcloud.upload.path() can be used as path constructors, so if you uploaded file "foo.txt" you can access it using rcloud.upload.path("foo.txt").
RCloud uses a different home directory from command-line R, so you need to use
list.files(rcloud.home())
in an R cell.

DirCopy() Not Working

I'm working in AutoIT to script a basic task I'll have to repeat on 50ish workstations.
I need to copy a directory and it's subdirectories and files (recursively) to a network share as a backup. For some reason, DirCopy() does not work at all.
I've tried running it on several different directories (thinking permissions issue, I'm Domain Admin account), tried doing a RunAs (again thinking permissions), and also put the #RequireAdmin tag to force the program to run on an elevated account. Nothing has worked. I can't even get it to copy empty directories.
DirCopy(#DesktopDir & "\SAMPLE\TEST1", #DesktopDir & "\SAMPLE\TEST2", 0)
Please advise!
Just figured this one out.
Turns out DirCopy() is a pretty stupid function that cannot handle if the destination directory already exists (it wants to create it for you). So if you kill the destination directory, then run the above code line, all woks as expected. But then if you add a new file into the source directory (TEST1 in my example), then it breaks again and does nothing.
Go figure...
Now time to find a work-around using something like xcopy...

Checking Wordpress core files

Is there a script or something that can check if all core files are installed properly. I am installing a Wordpress site on clients hosting, and for some reason around 100 files were not transferred due to the connection time out. Now I am moving them one by one, but still I would like to check somehow, once I am done, that all files transferred are there and their size is more than 0b.
Thanks.
Since you are using Filezilla, drag and drop all files again into the folder.
Then when the file exists message shows up, pick Overwrite if different size and check apply to current queue only. Then only the ones with different sizes (or the ones that weren't transferred) will be overwritten/updated.
There's an easier way:
If you have access to some kind of control panel like cPanel, you can make a .zip file and upload it only via Filezilla.
Then on cPanel, go to File Explorer and unzip from there. Will be faster and you just have to upload one file (rather than opening tons of connections and giving you timeout).
Or if you have shell access, you can login with your key using Terminal(mac) or Putty(win), browse the folder and run the unzip command.

Is it possible to set a default location for R packages instead of giving the user a choice?

Good afternoon!
I'm a system administrator at a university, and I am responsible for setting up the images for a computer lab. R is part of the default image, and for the longest time we only had a single log-in for all lab users, allowing us to set the default directory once and then image it across multiple systems. This has changed, and we're now having all users log on with a personalized log-in. That brings me to a problem I'm having with R, and why I'm turning to you.
You see, as most of you may be aware, when R is run for the first time, a dialog box opens up that prompts for a location to save packages and the like. Hit 'OK' and it's the user file, but hit anything else and it's wherever you put it. The problem is, we've locked down the systems rather tightly, and access to anything more than the user's individual directory is not something we like to do.
The question I have is this - is there a way to force R, on first run, via hands-free script or just a setting somewhere, to default to the user's directory on the system for package storage? This would prevent me from having to give All Users access to read and write to the R directory, and would have fewer possibilities of screwing up since they wouldn't actually have a choice to change it. If I have to continue giving permissions in that folder, I can, but I'd rather not.
Thanks!
Edit your .Renviron file to set the default path:
# .Renviron file
R_LIBS = '~/.R/library'
I can't test this right now, but I believe you could add something like Sys.setenv(R_LIBS_USER=path.expand('~\R\library')) to the Rprofile.site file found in the R etc directory.
'...to default to the user's directory on the system for package storage...'
another way, especially if you wanted different setting for staff/students would be to to use group policy to set an environment variable for selected machines/users at login.
e.g. the equivalent of...
SETX "R_LIBS" "\\fileserver2/department_shared/public/r/packages"
you can easily check if this has worked by starting R and trying
Sys.getenv("R_LIBS")
also, this command can then show you what packages are installed:
rownames(installed.packages())

Resources