This is my folder structure:
projectFolder
| |
| subFolder2
|
subFolder1
I have an R-script in subFolder1. How can I source a script in subFolder2 using a relative path?
OK, I got the answer:
source("../subFolder2/myScript.R")
Related
I have some folders with content in it like this:
Mainfolder
|
|---SubFolder1
|
|----ContentFiles1
|----MoreContentFiles1
|
|---SubFolder2
|
|----ContentFiles2
|----MoreContentFiles2
|
|---SubFolder3
|
|----ContentFiles3
|----MoreContentFiles3
and would like to zip the contents like this:
Subfolder1.zip
|
|--ContentFiles1
|----MoreContentFiles1
Subfolder2.zip
|
|--ContentFiles1
|----MoreContentFiles1
Subfolder3.zip
|
|--ContentFiles1
|----MoreContentFiles1
However, theres a problem. There are almost 600 of these folders which need to be zipped. I have tried various methods which almost worked but did just not make the cut, like:
for /d %%X in (*) do "F:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\" -mx=5 –tzip
This bat file gave me almost what i needed, but the format of those zip files were:
Subfolder1.zip
|
|--Subfolder1(folder)
|----ContentFiles1
|----MoreContentFiles1
Subfolder2.zip
|
|--Subfolder2(folder)
|----ContentFiles1
|----MoreContentFiles1
Subfolder3.zip
|
|--Subfolder3(folder)
|----ContentFiles1
|----MoreContentFiles1
These were sadly unusable.
This didn't seem like too tough of a task at first, but even after researching a little about batch coding and seeing multiple different youtube videos I still don't have a proper solution. The problem is that many of the methods I find either simply don't work or are outdated.
example pics:
What i get with methods i have tried
What i need
Codes which did not even open (either outdated or been used improperly by me):
#echo off
setlocal
set zip="C:\Program Files\WinRAR\rar.exe" a -r -u
dir C:\MyPictures /ad /s /b > C:\MyPictures\folders.txt
for /f %%f in (C:\MyPictures\folders.txt) do if not exist C:\MyPictures\%%~nf.rar %zip% C:\MyPictures \%%~nf.rar %%f
endlocal
exit
and:
#echo off
setlocal
for /d %%x in (C:\MyPictures\*.*) do "C:\Program Files\7-Zip\7z.exe" a -tzip "%%x.zip" "%%x\"
endlocal
exit
both found from: Batch file to compress subdirectories
note: i did indeed change the directories of these batch codes, but it did not work, and I am unsure what it meant by the "folder.txt" directories.
so if anyone knows anything or could tell me if it's not possible that would be great :).
Use .\folder\* syntax (dot and asterisk):
for /d %%G in (*) do "F:\Program Files\7-Zip\7z.exe" a "%%G.zip" ".\%%G\*" -mx=5 –tzip
Credits to https://superuser.com/a/340062
I built a very simple static page deployed to Github Pages.
I noticed quickly that most of the css background images failed to load.
After doing some digging around I found that the culprit is my SCSS/CSS.
In VSCode, my relative path for an image looks something like this:
#media (min-resolution: 192dpi) and (min-width: 37.5em),
(-webkit-min-device-pixel-ratio: 2) and (min-width: 37.5em),
(min-width: 125em) {
background-image: linear-gradient(
to right bottom,
rgba($color-primary-light, 0.801),
rgba($color-primary-dark, 0.801)
),
url(../../img/apple-mountains_1920.jpg);
However, this was causing the URL to become clipped, stepping backward out of the repository.
What it should be:
https://name.gethub.io/repositoryname/img/apple-mountains_1920.jpg
What I was getting:
https://name.gethub.io/img/apple-mountains_1920.jpg
To fix this, I simply needed to go through and remove one period from all of my background-image paths:
url(../../img/apple-mountains_1920.jpg);
Becomes:
url(./../img/apple-mountains_1920.jpg);
One thing that is interesting, is that in VSCode on my machine, if I don't use the format (../../img...) the file isn't found.
What am I doing wrong? I'm fairly new to deployment, is this going to be a problem with any webhost I use or is it something unique to Github pages?
Better yet, is there a way I can automate fix this in my build process?
Right now I just run my SCSS through this series:
"compile:sass": "node-sass sass/main.scss css/style.comp.css",
"concat:css": "concat -o css/style.concat.css css/icon-font.css css/style.comp.css",
"prefix:css": "postcss --use autoprefixer -b \"last 5 versions\" css/style.concat.css -o css/style.prefix.css",
"compress:css": "node-sass css/style.prefix.css css/main.css --output-style compressed",
EDIT:
My File tree structure is:
Project Folder
|- index.html
|- [css folder]
|- [img folder]
|- [js folder]
|- [sass folder]
| |- main.scss
| |- [abstracts]
| | |-_functions.scss
| | |-_mixins.scss
| | |-_variables.scss
| |- [base]
| | |-_base.scss
| | |-_typography.scss
| | |-_utilities.scss
| |- [components]
| | |-_buttons.scss
| | |-_form.scss
| | |-_cards.scss
| |- [layout]
| | |-_footer.scss
| | |-_header.scss
| | |-_navigation.scss
| |- [pages]
| | |-_home.scss
My development machine is Windows 10, if that makes a difference.
Thanks!
Try that '../img/apple-mountains_1920.jpg'
If your file-tree look like
somefolder
index.html
img
thisImage
But what would be better - add your file-tree to question
After digging around, it seems that the problem is due to me attempting to use a 7-1 style folder structure where the source SASS isn't in the same or similar structure to the CSS.
Seems that I might need to take advantage of a package like resolve-url-loader in order to fix the relative paths automatically.
I'm trying to include a picture from my ubuntu machine into a gvisTable.
The path is specified as
<img src="google_logo.jpg"/>
And the folder structure looks like this:
+---/srv/shiny-server
| +---shinyApp
| +---server.R
| +---ui.R
| +---wwww
| +---google_logo.jpg
Pictures with an url do work, I played around with different placements of google_logo.jpg and the permission of google_logo.jpg, but I can't make it work.
In my css file I can access local images in the same directory with url("image.png")
Any suggestions?
So as in the question.
I have structure of folders lets say like this:
|-root
| |
| |-someFolder
| | |
| | |-someSubFolder
| |
| |-someAnotherFolder
etc. in general I don't know far folder can be nested, but I need sometimes to
find path to a folder, that I don't know it's location (only name).
How can I do this using CMake? The only thing i found was find_path, but as I am looking for another CMakeLists.txt file in whole project, that is in the specific folder I cannot effectively use it.
So what is the way to find path to folder of given name provided I know path to the root folder?
I need to list files from a specific file name until another specific file name. For example I have file1.txt, file2.txt, file3.txt, file4.txt, file5.txt if I wanted to start at file2.txt and end at file5.txt it should list the file names (not the content) file2.txt, file3.txt, file4.txt and file5.txt. Is there a way to do this using head and tail and if not what is a good way to do this?
ls | sort -n | sed '/file2/,/file5/!d'
ls -l | sort -n | grep -B1000 "file5.txt"