Get path to folder using uigetfile in Matlab - user-interface

I know that you can create a file browser in Matlab using uigetfile. However, I want the user to be able to select a destination folder. I am currently using the following code:
[filename, pathname] = uigetfile;
Using this, the user has to select a file within the destination folder in order to actually be able to close the file browser. Is there a better way of doing this ? For example, allow the user to select a folder and this closes the file browser whilst returning just the path to the chosen folder. Your help is much appreciated.

UIGETDIR is what you're looking for.

Related

Pathway to directory lost in R studio

I am relatively new to R studio, I am attempting to import a .RNK file to run on GSEA. However, the pathway to my working directory is lost and I keep receiving a file, "rt" warning message.
When comparing my working directory with my usual windows explorer file, the files themselves are absent from the working directory.
I have attempted to change the Default text encoding to UTF-8 but this has had no effect. I would be grateful for any suggestions to help with this problem?
That is a very common problem!
You have four options to select the correct file and path! Hope at least one can work well.
Manually without code, you can go to the top and choose Session->Set Working Directory -> Choose Directory... and then select the file.
You can just use the function file. choose() and look for the file on your computer and select it.
You can look for the file path on your computer and write it in R. Look in the local search engine for your computer and search for the file. For example: setwd("~/Desktop/University/Homework")
You can use getwd() in the console to know where the script is working and saving the files and then look for the files there!
PD: the best way to work in R and R-Studio/Posit for me is by creating a project. Doing so, you will have everything related to the script in one folder (new and old files!). It is similar to setwd()but better!

How can I download the large file from google drive using rclone?

Now I want to download the dataset on the website(http://pubchemqc.riken.jp/), it's in google drive and filesize is 2TB. the website recommend using rclone to download the file but not said how to use.
As the picture shows
This was asked a while back already but I'd like to keep it recorded here as it seems hard to find.
Unfortunately I don't know if there's a way to automate this process but it's still easy.
What you can do is create a new remote with the link's root_folder_id.
The Root Folder ID is present in the url e.g:
in the example link
https://drive.google.com/drive/folders/a1b2c3deFgHi4JKlm56nOpqrStuv7w8xy9
the root_folder_id is the string after the slash /folders/ so in this case it would be "a1b2c3deFgHi4JKlm56nOpqrStuv7w8xy9". If the Google Drive shared link you got is a folder all you have to do is copy that id and use it in the rclone's new remote setup. Now if the shared link points directly to a file, like the one in the OP, there's no folder to download it from, so we gotta create our own! The whole process would look like:
get the folder_id from Google Drive's link. If it is a link to a direct file then first we have to create a new folder anywhere inside our own Google Drive, it's name doesn't matter as we will point directly to it using the ID. After creating this new folder, open it and note the url, it should look something like
https://drive.google.com/drive/u/1/folders/Fdrcv3nQvxQqXUGEEyvacwUxdYXpV33Ct
just copy everything after /folders/ and save it for later.
now go back to the link of the direct file. Add a shortcut for that file to inside your recently created folder, so say the folder was named dl-with-rclone, click the "Add shortcut to Drive" icon and navigate to the "dl-with-rclone" folder to add the shortcut there.
heading to rclone, do:
rclone config <to open settings>
On the prompt e/n/d/r/c/s/q> hit n (the key relative to creating a new remote)
On name> give it a name like sharedWithMe or anything else for personal reference later
On the prompt Storage>, the possible remotes to connect to, write down drive or the number relative to it (currently 15)
if you set up your own client_id and client_secret you put them next
On the scope> prompt option 2 "Read-only" is enough
now this is the important one:
on the root_folder_id> prompt input the ID of the folder of the shared link or the folder you created and pointed the file shortcut to, e.g. Fdrcv3nQvxQqXUGEEyvacwUxdYXpV33Ct
Now you can pretty much hit enter for everything, once you reach Use auto config? you will be redirected for a browser to login. Make sure the logged in account is the same that you created the folder for the shortcut. If the shared link is for a folder already your logged in account doesn't matter.
After finishing your remote setup you can exit rclone config
The command you would need would be something like rclone copy sharedWithMe: destination/folder
This being rclone you would surely be able to copy from one remote to another, that's up to the user.
In summary: I did test this method on your link, creating a folder in my Drive, pointing the file shortcut to it and using the root_folder_id to setup the rclone remote and it did begin to download:
rclone test download screenshot

How to get file path in browser (using protocol or other method to get full path)

Using a desktop mac computer, is it possible to enable someone to drag and drop a file into a web page and return the full path of the file?
Having something similar to the S3 dialogue box and then enabling a user to drag a file in there and the full path show up. Would this be possible to do within the browser alone? What about with a protocol that the user has installed on his computer? For example, something like: https://support.shotgunsoftware.com/entries/127152-Launching-External-Applications-using-Custom-Protocols-under-OSX. If so, how would that be done?
It would not be possible to do it through the browser alone.
How to get full path of selected file on change of <input type=‘file’> using javascript, jquery-ajax?
As for some other workaround, I am not sure.

Always save specific file type in windows to one location?

I'm trying to do the following I'm not sure if it's possible using VB.NET.
I want to specify default saving point for all files type for example:
In my program you choose the path "C:\Users\Markus\Pictures" for pictures and everytime you download pictures files from website, or using skype or any other program when Save File Dialog opens up (external one not via my program or connected to vb.net just the windows default one) then it will show "C:\Users\Markus\Pictures" always for .jpg .gif type of files etc...
Thanks a lot.
This bits of codes should solve your problem
SaveFileDialog1.InitialDirectory = #"C:\Users\Markus\Pictures"
InitialDirectory property represents the directory to be displayed when the open file dialog appears first time.
SaveFileDialog1.Filter = "txt files (*.jpg)|*.jpg|All files (*.*)|*.*"
Filter property represents the filter on an open file dialog that is used to filter the type of files to be loaded during the browse option in an open file dialog.
refer to this link for more info
You can programmatically modify the paths of the Windows special directories (My Pictures, etc) in the registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
However, your app will have to be granted permissions to do so (see RegistryPermission Class)
Of course, this will work for those file types that have entries in this registry key, and only if an external application uses this key

firefox bookmarks folder path

How I can find path to bookmarks folder in firefox. My disk is pluged via USB as an external hard disk and I want to find my bookmarks and save them on my notebook.
First set:
(show hidden files and folders) and then go to:
E:\Users[username]\AppData\Roaming\Mozilla\Firefox\Profiles\ls6pqqyi.default\bookmarkbackups
inside json file is bookmarks address. Use Ctrl+F to find.
I don't know the actual folder where it stores. But I can give an idea to solve your problem.
There is one tool called "MozBackup.exe". You can use this tool to store all your firefox browser related information on it. Ofcourse you can restore it again using the same too.
All bookmarks are stored in a file named "places.sqlite".
In order to reach to the file go to following path:
C:\Users[YOUR_USER]\AppData\Roaming\Mozilla\Firefox\Profiles[PROFILE_FOLDER]\places.sqlite

Resources