save or write the files of directory in sandbox file system to user selected directory in chrome app - google-chrome-app

Summary:
Is there any way to save all files of sandbox file system directory to user local directory? I need user prompt only for directory not for each files.

Yes, it should be possible if you declare "directory" sub-permission in your manifest:
"permissions": [
{"fileSystem": ["write", "directory"]}
]
Then, you can request access to a directory with chrome.fileSystem.chooseEntry using type: "directory", convert the result to a writable entry using chrome.fileSystem.getWritableEntry (see comments) and then write the files you need.

Related

cannot zip locked access file

I am writing a powershell script which creates a zip file of a local folder:
[System.IO.Compression.ZipFile]::CreateFromDirectory('c:\myfolder\', 'c:\myarchive.zip', [System.IO.Compression.CompressionLevel]::Fastest,$true)
This folder contains an MS-Access database. This database is opened at the same time by another user. I cannot ask him to close this database.
The zip operation fails because the database is locked. Is there a way to bypass this lock and make a copy of the database ?
Thanks a lot
Copy the folder to a temporary place and zip the copy.

Script to clone a template folder retaing permissions and prompt for new folder name

May I please get your insight?
I have a user group in AD call Contract Admin. I like would this user group to be able to run a script that clones a template folder (retaining permissions) to a new folder and prompt for a new client name.
The folder structure would be as follows:
Clients
New Folder (template folder) (Permissions: Admins, Contract Admin, Financial Admin)
Statements Folder (Permissions: Financial Admin)
End result after script:
Clients
ABC Company (Permissions: Admins, Contract Admin, Financial Admin)
Statements Folder (Permissions: Financial Admin)
Above is an example of the folder structure where New Folder is the template folder which also has a folder inside of it as well. I'd like to have the folders cloned with permissions retained.
I hope this is clear, I apologize if it is not. Thank you so much for your help.
The code I currently have for copying the permissions are as folows:
robocopy /e /copy:DATS "X:\Template" "X:\New Folder Name"
attrib -h "Template"
This is what I have for cloning the folders but I am lost from here.
Thank you
Solution:
#echo off
set "src=C:\Users\XXX\Desktop\template folder"
set /p "dest=Name of Client?: "
robocopy /e /copy:DATS %src% %dest%
the source can simply be the folder/file name without the full path if both the script and the folder/file to be copied is in the same directory.
/copy: Specifies the file properties to be copied. The following are the valid values for this option:
D Data A Attributes
T Time stamps S NTFS access control list (ACL)
O Owner information
U Auditing information
The default value for
CopyFlags is DAT (data, attributes, and time stamps).
But this is not a script. It's a robocopy command.
There are many switches robocopy, see its help file for them.
Specifically the mirror (/MIR) a folder tree to a new location.
As for prompting users, there are a few ways to do this. The most direct is Read-Host cmdlet provides. You simply capture that in a variable and pass that as the folder.
$FolderPath = Read-Host 'Enter a folder path.'

How to set StaticFileServer() using Kitura?

I want to see files in my localhost directory using Kitura.
I've written:
router.all("/test/*", middleware: StaticFileServer())
but it didn't seem to work
I want to all files in my directory. Similar to directoryIndex
You can pass the path to a directory to serve to StaticFileServer, as path parameter, by default it is "public":
router.all("/test/", middleware: StaticFileServer(path: "MyDirectoryWithStaticFiles"))
Then you will be able to access the files in this directory, but not the directory itself. E.g., you will be able to perform GET /test/someFile.html, but not /test/. You will be able to GET /test/, if your directory will contain index.html.
See https://github.com/IBM-Swift/Kitura-Sample for example of using StaticFileHandler.

Total Commander external editor emacs "permission denied" on editing files

I configured my Total Commander so I can open a file *.txt i.e. within emacs.
Therefore I setup my Editor
D:\Tools\emacs\bin\emacsclientw.exe "%1"
When I now open my file everything is ok. But when I edit it and save it emacs tells me the following:
Saving file c:/log.txt...
basic-save-buffer-2: Opening output file: permission denied, c:/log.txt
How do I make it run so it can actually edit files?
By Default you should not be saving anything to root C:\
It is just bad practice and by default a normal user does not have permission to it.
Instead, create a working DIR in your Documents folder and a log directory in that, then you will have something like:
C:\Users\Frank\Documents\Working\logs\log.txt
This should not create any permission errrors.

Need to copy a file into common folder location path for each user in one go

I have a file (named test.txt) that is currently only located on the Windows desktop for my user account. I need to copy this file to the same directory in each user account on this computer, such as:
C:\Users\MR.A\AppData\Roaming\Settings\test.txt
C:\Users\MR.B\AppData\Roaming\Settings\test.txt
C:\Users\MR.C\AppData\Roaming\Settings\test.txt
Within each user account, the path to the new location would be the same. How would I do this using the command line?