Is it possible to allocate these folders in another place?
Finally, I got the solution to move three of the folders that I put above. I think it could be interesting to put here the problems that I faced and the changes that I made to solve them.
I'm going to investigate about the last folder, .oracle_jre_usage
, and I will complete this answer if I got a solution for it. Look that I complete the solution for .gradle
folder.
To move .android
folder
Really, following the steps of the blog that Rahul Tiwari
provided, this folder could been moved. Nevertheless I'm going to put here all the process:
You have to move your
.android
folder, after closingAndroid Studio
(if you have it running), to the folder in which you want that it will be stored, in my case,C:\Users\Administrator\AndroidStudio
.BEWARE WITH THE SPACES IN THE NAME OF THE NEW FOLDER, IT COULD GIVE TO YOU PROBLEMS (AS ME). I mean,
Android Studio
,New Folder
or similars.If you are on
Windows
, you can do right-click onMy Computer > Properties > Advanced System Settings > Environment Variables
and create a new environment variable namedANDROID_SDK_HOME
and as value you have to put the new path in which.android
folder will be stored. It's the same path in which you have moved the.android
folder in the step above.Click "OK" button to accept your changes.
Re-launch
Android Studio
and look that the.android
folder doesn't appear in the default path.
To move .AndroidStudio1.3
folder
With that folder I had some problems because I didn't noticed some details that were very important. Here the steps that I followed:
First of all, you have to close
Android Studio
before doing any change.After, you have to move the folder
.AndroidStudio1.3
to the path in which you want that it will be stored.Next, you have to go to the folder in which
Android Studio
were installed and open "idea.properties" file and changed the lines where idea.config.path and idea.system.path appeared for the new path in which these folders are going to be located.
They have to be something similar to this:
idea.config.path=C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/config
idea.system.path=C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/system
Here I had three problems so please be careful:
- Notice that the paths are with
/
and not with\
asWindows
put by default.
- DON'T CHANGE the values of idea.plugins.path and idea.log.path (My EDIT 3). Be sure that you are changing idea.config.path and idea.system.path values.
- Uncomment the lines in which idea.config.path and idea.system.path appears. I mean, remove the
#
that they have at the begining of each line.
- The last step, re-launch
Android Studio
.
Searching and doing some proves I also get the solution to move .gradle
folder. The steps are the same as .android
folder but I put here all the steps (with the values that changed) to avoid any confusion. Here it is:
To move .gradle
folder
You have to move your
.gradle
folder, after closingAndroid Studio
(if you have it running), to the folder in which you want that it will be stored, in my case,C:\Users\Administrator\AndroidStudio\.gradle
.BEWARE WITH THE SPACES IN THE NAME OF THE NEW FOLDER, IT COULD GIVE TO YOU PROBLEMS (AS ME). I mean,
Android Studio
,New Folder
or similars.If you are on
Windows
, you can do right-click onMy Computer > Properties > Advanced System Settings > Environment Variables
and create a new environment variable namedGRADLE_USER_HOME
and as value you have to put the new path in which.gradle
folder will be stored. It's the same path in which you have moved the.gradle
folder in the step above.Click "OK" button to accept your changes.
Re-launch
Android Studio
and look that the.gradle
folder doesn't appear in the default path.
batch distribute files in a folder into some folders
This will distribute files evenly between the folders and if there are any files remaining, they'll be copied to the last folder
The input folder will be received in %1
. The number of folders is put in %totalfolder%
variable. The folder names (m_1
... m_8
) will be split into 2 parts: prefix (m_
) in %folderprefix%
variable and the folder number which is counted in !foldernum!
variable
@Echo off
If "%1"=="" (
Echo Usage: %0 '^<base folder^>'
Exit /b
)
SetLocal EnableDelayedExpansion
Rem Get number of files in the folder
For /f %%A in ('dir %1 ^| find "File(s)"') do set totalfiles=%%A
Rem Set your parameters here
Rem First part of your folder name
Set folderprefix=m_
Rem m_1 ... m_8 => 8 folders
Set totalfolder=8
Set /a files_per_folder=totalfiles/totalfolder
Set filenum=1
Set foldernum=1
For %%f in (%1\*) do (
Move "%%f" "%folderprefix%!foldernum!\"
Rem Move to next folder by increasing folder number "
If !filenum! EQU %files_per_folder% (
If !foldernum! LSS %totalfolder% (
Set /a foldernum+=1
Set filenum=0
)
)
Set /a filenum+=1
)
The script basically maintain a count of files in each folder and if the folder is filled completely it will move to the next folder
How can I move the contents of one directory tree into another?
Update:
Adjusted code to a. check whether folders already exist at the destination, in which case move files in that folder over (and continue traversing the source directory structure), otherwise move the folder wholesale.
At the end of the script the source folder is removed altogether to eliminate these folders which have had their files moved over to an already existent folder at the destination (meaning these folders have been emptied but not deleted at the source).
Additionally we check whether a folder is both empty and already exists at the destination in which case we do nothing (and leave the source folder to be deleted to the last line of the script). Not doing this results in "The filename, directory name, or volume label syntax is incorrect." errors.
Phew! Please let me know how you get on with this! I have tested this and it seems to be working well.
for /d /r "c:\source" %%i in (*) do if exist "c:\destination\%%~ni" (dir "%%i" | find "0 File(s)" > NUL & if errorlevel 1 move /y "%%i\*.*" "c:\destination\%%~ni") else (move /y "%%i" "c:\destination")
move /y c:\source\*.* c:\destination
rd /s /q c:\source
Moving default AVD configuration folder (.android)
I've found the answer.
- Move
.android
folder toE:\Android
- Create environment variable called
ANDROID_SDK_HOME and set its value toE:\Android
Setting the environment variable on Windows XP or Windows 7:
- Right-click on My Computer and choose "Properties"
- Click the "Advanced" tab
- Click the button "Environment Variables".
- Add New variable
How to grant permission to users for a directory using command line in Windows?
As of Vista, cacls
is deprecated. Here's the first couple of help lines:
C:\>cacls
NOTE: Cacls is now deprecated, please use Icacls.
Displays or modifies access control lists (ACLs) of files
You should use icacls
instead. This is how you grant John full control over D:\test
folder and all its subfolders:
C:\>icacls "D:\test" /grant John:(OI)(CI)F /T
According do MS documentation:
F
= Full ControlCI
= Container Inherit - This flag indicates that subordinate containers will inherit this ACE.OI
= Object Inherit - This flag indicates that subordinate files will inherit the ACE./T
= Apply recursively to existing files and sub-folders. (OI
andCI
only apply to new files and sub-folders). Credit: comment by @AlexSpence.
For complete documentation, you may run "icacls
" with no arguments or see the Microsoft documentation here and here
PHP - Move a file into a different folder on the server
The rename
function does this
docs rename
rename('image1.jpg', 'del/image1.jpg');
If you want to keep the existing file on the same place you should use copy
docs copy
copy('image1.jpg', 'del/image1.jpg');
If you want to move an uploaded file use the move_uploaded_file
, although this is almost the same as rename
this function also checks that the given file is a file that was uploaded via the POST
, this prevents for example that a local file is moved
docs move_uploaded_file
$uploads_dir = '/uploads';
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
move_uploaded_file($tmp_name, "$uploads_dir/$name");
}
}
code snipet from docs
How to change folder with git bash?
The command is:
cd /c/project/
Tip:
Use the pwd
command to see which path you are currently in, handy when you did a right-click "Git Bash here..."
R: locating files that their names contain a specific string from a directory and match to my list of wanted files
This works:
library(stringr)
# get this via list.files in your actual code
files <- c("ctrl_S978765_uns_dummy_00_none.txt",
"ctrl_S978765_3S_Cookie_00_none.txt",
"S59607_3S_goody_3M_V10.txt",
"ctrlnuc30-100_S3245678_DMSO_00_none.txt",
"ctrlRAP_S0846567_3S_Dex_none.txt",
"S6498432_2S_Fulra_30mM_V100.txt")
ids <- data.frame(`ID Code` = c("S978765", "S978765", "S306223", "S897458", "S514486"),
CLnumber = c(1, 2, 1, 1, 2),
stringsAsFactors = FALSE)
str_subset(files, paste(ids$ID.Code, collapse = "|"))
#> [1] "ctrl_S978765_uns_dummy_00_none.txt" "ctrl_S978765_3S_Cookie_00_none.txt"
str_subset
takes a character vector and returns elements matching some pattern. In this case, the pattern is "S978765|S978765|S306223|S897458|S514486"
(created by using paste
), which is a regular expression that matches any of the ID codes separated by |
. So we take files
and keep only the elements that have a match in ID Code
.
There are many other ways to do this, which may or may not be more clear. For example, you could pass ids$ID.Code
directly to str_subset
instead of constructing a regular expression via paste
, but that would throw a warning about object lengths every time, which could get confusing (or cause problems if you get used to ignoring it and then ignore it in a different context where it matters). Another method would be to use purrr
and keep
, but while that might be a little bit more clear to write, it would be a lot more inefficient since it would mean making multiple passes over the files vector -- not relevant in this context, but possibly very relevant if you suddenly need to do this for hundreds of thousands of files and IDs.
Related Topics
Android 3.1.1 - Failed Resolution Of: Lcom/Google/Android/Gms/Common/Internal/Zzbq;
Android Sharedpreferences Limitations
Firebase Create User Without Sign In
Display Unity Scene as Sub View in Android Studio
Force a Camera to Always Open in Portrait Mode in Android
How to Import Contacts from Phonebook to Our Application
Out of Memory While Creating Bitmaps on Device
Implementing a Simple Dagger2 Sample
Achartengine - Can't Figure How to Use Dates as X Axis - the File I Save Is Empty
Could Not Launch Emulator in Android Studio
Checkbox Gets Unchecked on Scroll in a Custom Listview
Pass Arraylist Data into Soap Web Service in Android
How to Create/Write File in the Root of the Android Device