Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Imagine this is my folder structure
filepath\targetpath
filepath\folder1
I can create the symlink when I am inside the targetpath folder
ln -s ..\folder1 folder2
but when I try to create symlink from upper level with below command
ln -s filepath\folder1 filepath\targetpath\folder2
it create shortcut file rather than a symlink to filepath.
How can I create symlink when I am outside of the targetpath folder?
If a symbolic link is not an absolute pathname (begins with /) it is interpreted relative to the directory containing the link, not your cwd when you make the link. So if you do:
ln -s filepath/folder1 filepath/targetpath/folder2
the target of the link is filepath/targetpath/filepath/folder1. You should make the symlink the same way as you did the first time:
ln -s ../folder1 filepath/targetpath/folder2
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am very new to scripting, can anybody tell how can I switch to directory in bash.
I have tried to do like this
-bash-4.2$ cd /c
and cd c but nothing works!
Check if you have any directories in your current path!
You can check that by ls -lrt which lists the files and directories in your current path.
If there are no directories, create one using mkdir c and then do cd c
Also you can navigate to your previous directory by using cd - and your home directory by doing a cd ~
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
If the ls command lists the contents of a directory, then some output to ls <directory would seem to indicate that a directory exists.
For example, this is what I get:
> ls ~/.ssh
id_rsa id_rsa.pub known_hosts
But why then, when I type cd ~/.ssh do I get
> cd ~/.ssh
The system cannot find the path specified.
?
Why can I list the contents of this directory but not navigate to it?
I am using Windows 8
This answer is under the assumption that you are using the command prompt to execute these commands.
The reason that you can ls the directory but not cd to it, is because the ls command comes from a library that you downloaded that makes ls work on windows.
In contrast, your cd command is being executed from Windows, not from the library you downloaded.
In short, ls knows how to parse the tilde (~) as home, but windows doesn't know how to parse ~. try it: cd ~. it won't work.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a folder on my desktop that has around 2500 folders in it, each folder has multiple files in them that are zipped, I can unzip them by manually clicking on them, is there a way to do this automatically through terminal?
find ./ -name \*.zip -exec unzip {} \; maybe?
you can try the unzip command, but i think it only works with zip/tar files.
http://www.lifewithtech.net/apple/tip-unzip-multiple-files-into-a-single-directory-in-mac-osx/
http://magma.maths.usyd.edu.au/magma/faq/extract
or if you have the app The Unarchiver:
you can use the open command.
cd to your folder and use:
$ open */*.rar
this should extract all rar files in all sub-folders, according to your Unarchiver setup into a new folder or in the same folder.
Hope this helps.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How do I navigate using a symlink?
I created a symlink, let's say 'projects' to my '/Desktop/Work/Projects' folder. So if I type 'ls' in my root directory, I see a bunch of things, the symlink among them. 'cd projects' fails with the error:
-bash: cd: projects: No such file or directory
The symlink is broken. If by 'your' /Desktop/Work/Projects you mean /home/youruser/Desktop/Work/Projects, then that's the path you should symlink to:
ln -s "/home/youruser/Desktop/Work/Projects" "/home/youruser/projects"
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm trying to create a directory in a shell script:
mkdir -p DirName
but I always get the same error:
cannot create directory `/DirName': Permission denied
If I run the same command directly from the shell instead of using the scripts, that works perfectly.
any idea?
Thank you! :)
If you're going to use the -p option, you need to specify the full path
mkdir -p /some/path/here/DirName
I suggest listing the full path (If you plan on your shell script to change locations).
If your shell script isn't going to change locations (you're not going to move it somewhere else later), I'd use:
mkdir ./DirName
These should all behave similarly to you creating the directory in the shell.
You are trying to create a directory in the root of the filesystem (/DirName) instead of in the current directory (Dirname or ./Dirname). You don't have access to write to the root.