Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move backward parent folder

Tags:

file

r

People also ask

How do I move a folder backward?

To navigate to your home directory, use "cd" or "cd ~" To navigate up one directory level, use "cd .." To navigate to the previous directory (or back), use "cd -"

How do you move from the current directory to the parent directory?

To change your current working directory to its parent folder (move one branch down the directory tree): > cd .. To move the file data.

How do I move a file back?

Highlight the files you want to move, press and hold your right mouse button, and drag-and-drop the files to where you want to move them.


setwd('..')

will move up one directory without entering the absolute path. Here's an example

> getwd()
[1] "C:/Users/D/Desktop/EDABaseball"
> setwd('..')
> getwd()
[1] "C:/Users/D/Desktop"

I think you want to move back to the working directory ./parent/Child/. This can be done in 2 ways, assuming your current working directory is ./parent/Child/A

1) setwd("..")

2) setwd("./..")

3) setwd("./parent/Child")


I also find dirname() function pretty useful especially if your path is saved in a variable:

mypath <- getwd()

# The path of the parent directory:
dirname(mypath)

Moves up one directory in Linux

setwd("../")