Move one folder to another in Google Colab through code - google-colaboratory

In Google Colab, I want to move one folder inside another. E.g. move child_folder parent_folder.
I am able to drag the child_folder to parent_folder, but when I try the below command, I get the error: /bin/bash: move: command not found
!move child_folder parent_folder
Is there any command for this in Google Colab

The command to move files is mv rather than move. So, write instead:
!mv chold_folder parent_folder

Related

Downloading partial data from Kaggle

I am working on a project that identifies chess positions. The main database I found is on Kaggle however is it's size is 2 GB. Does anyone know if I can download only a small portion of the set instead of the entire thing?
link: https://www.kaggle.com/koryakinp/chess-positions
One way you can do it by clicking on the file one by one and click the download button on the top right of the file.
One more way you can do it download everything and delete the files you dont want.
Or you can use wget in command prompt or curl in terminal and use --max-filesize to limit it to the amount of bites you want.

Google Colab runs on a folder out of "My Drive" folder

I am doing an online course and i use Colab for the assignments.
The initialization code is given to me, so all i need to do is to run it and start to code.
The problem is that for some reason Colab decided to separate one folder- "cs231n". I can still see this folder in the tree on the left under "My Drive", but when calling functions that i write there in the bottom one (i write in .py files), from the .ipynb notebook, nothing happens. like the .py file doesn't exist.
But when writing the code in the separated folder, which is not under "My Drive" (the upper one), .ipynb works fine.
So i do my assignments with the upper cs231n separated folder, but it is a twisted way to go...
The actual path in my drive:
path
The Colab initialization and the folders-tree:
colab
Thanks :)

Share a unique version of google colab doc?

Does anyone know how exactly I can share a unique version of a google colab doc? I have a colab sheet on my Google Drive and I want to allow for someone to access the file, run, make edits, etc. However, I don't want any of the edits made to be on my version of the doc.
I've searched everywhere...
To share a link to your notebook that allows editing but does not modify your copy, first open the notebook in playground mode using the command palette. (Tools menu -> Command palette)
Then, select the 'Open in playground' command.
This will reload the notebook with a new URL that you can share, allowing others to modify and execute an ephemeral copy of the notebook without modifying the original. If they attempt to save, they will be prompted to create a copy in their own Drive.

How can I preserve cell outputs on uploaded notebooks?

I uploaded a previously created Jupyter notebook. I could initially see all the cell outputs in Colab right after uploading it, but if I close the notebook and come back to it later -- or if I share the notebook with a coworker -- then all the cell outputs have been cleared, which is quite annoying.
This is happening even though I've verified that the following two checkboxes are UNCHECKED:
Edit > Notebook settings > Omit code cell output when saving this notebook
Tools > Preferences > New notebooks use private outputs (omit outputs when saving)
From what I can tell, it looks like the cell outputs get preserved across sessions for notebooks created and edited in Colab, but not for notebooks that were created elsewhere and then uploaded. What am I missing? How can I preserve cell outputs across sessions in uploaded notebooks?
Are you trying to open the file from Drive directly in Jupyter?
If so, you'll need to save the full file using the File -> Download ipynb menu item.
By default, Colab saves outputs using a different format to support incremental saves, so the Drive file created during auto-save will show outputs, but only in Colab itself, and you'll need to download the full ipynb to export to other notebook viewing tools.

NSIS doesn't backup all files

An NSIS installer creates a fairly large folder structure. When the installer starts, it checks the registry to see if there is a current version installed...
Then it asks if you want to make a backup of the current folder.
It works most of the time, but sometimes when it is backing up older versions, instead of copying over the entire directory, it only copies the icon.
!insertmacro un.MoveFolder "$INSTDIR" "${BACKUP_FOLDER}" "*.*"
Reference: http://nsis.sourceforge.net/MoveFileFolder
!insertmacro MoveFolder "$INSTDIR\[path\]source-folder[\]" "$INSTDIR\[path\]destination-folder[\]" "file-mask"
Afterwards, it moves on to the delete section...
Could it be that it doesn't have time to do it ? it starts the next process before finishing the move ?
What else could be going on so that it does not copy the entire folder ?
During the installer, I see
Create folder c:\backup_folder
Moving files: c:\current_folder\*.* to c:\backup_folder\
Delete file: c:\current_folder\file1.........
And at the end, backup_folder has only the icon (not all the files)
Edit: The solution - please see my post here NSIS difficulty moving folders - $INSTDIR is indeed a special folder so I had to move the uninstaller to a $TEMP folder.
Is there any reason why you cannot use the built-in CopyFiles command?
To debug this I would suggest that you add a DetailPrint near the top of the .MoveFolder_Locate_moveFile function. If you see all the file names go by then the problem is the move operation in that function, if not then the problem is in the ${Locate} macro used by this code.
Another alternative is to watch the filesystem operations with Process Monitor...