mac how to get the symlink original path - node.js

I have symlinked a file in hard drive A in linux with nodejs symlink. When I plug the hard drive to macbook, the symlink breaks because the mounted root direcotry in macOS is different to linux. Is there a way in macOS to get the file's original path string with node, so I can use it by replacing the mounted directory in order to read the original file in the hard drive?
For example,
in linux link: /media/A/src/abc.jpg -> /media/A/dst/1.jpg
in mac, read /Volumes/A/dst/1.jpg's link /media/A/src/abc.jpg, then manual change to /Volums/A/src/abc.jpg to read the file

Use relative paths instead of absolute paths in the symlinks. E.g.
/media/A/src/abc.jpg -> ../dest/1.jpg
Then the links will work the same no matter where the drive is mounted.

Related

How can I access C folder in power shell?

I have very simple problem with approaching C drive in Ubuntu 20.04.3 on my personal computer.
I'm using command following:
cd \home\C:
But I get error: bash: cd: homeC:: No such file or directory
Do you know which command should be used to do so?
First check your mointing points, using the mount function. In case of a Windows subsystem for Linux you might have something like this:
C:\ on /mnt/c type drvfs (rw,noatime,uid=1000,gid=1000,case=off)
D:\ on /mnt/d type drvfs (rw,noatime,uid=1000,gid=1000,case=off)
The part on /mnt/c (can be different in your case, obviously), shows the actual Linux folder. Please keep in mind that Linux is case sensitive.

Linux: Non-Executable Installation File

I've gotten a USB drive in which the installation files of MATLAB are found. I've tried executing the following command but none worked. Something is wrong. The file doesn't seem executable.
This is the file I need to execute:
-rw-r--r-- 1 user user 8360 Jul 19 03:29 install
I do:
sudo sh ./install
and get:
./install: 1: exec: /media/user/DPI/R2019b/bin/glnxa64/install_unix: Permission denied
I tried chmod +x install but it also doesn't work. The file cannot be turned into an executable one.
Is the file corrupt, or do I miss something?
Probably the USB drive is formatted by the manufacturer as FAT32 or similar. This file system doesn't support UNIX permissions.
That means you lose the permission information when you copy the files to a USB drive.
You have several options to fix this:
On a Linux/UNIX system create a .tar archive of the files, copy the archive onto the USB drive and unpack the archive to a UNIX compatible file system on the destination system. (This is a bit more work but allows to use the USB drive also on a Windows system.)
Format the USB drive as a UNIX compatible file system. (This might be the best solution if you plan to use the USB drive with Linux systems only. You can no longer use it on a Windows system except if you install special drivers.)
Copy all the files from the USB drive to a local drive on the destination system, which schould have a UNIX compatible file system, and try to fix the permissions manually. (I don't recommend this solution except if you cannot use the others, e.g. if you no longer have access to the original files.)

How to navigate to a file inside a directory via Linux command prompt

Please, I have been trying to navigate to a txt extension file inside a directory via Linux command prompt, but it shows "The directory name is invalid."
C:\Users\GACHIO\wamp\www\Project\etc\nail.txt
That's a windows Directory path. On a Linux OS the root of the file system will not start with "C:\".
Do you have the Windows file system (disk) mounted already within your Linux OS? If so you will need to use the Linux mount point as the start of your quest. I believe Ubuntu will automatically attempt to mount the HDD nowadays under the /media/"username"/"diskname" path
EX. (Ubuntu) to list the file
ls /media/bob/windows/Users/GACHIO/wamp/www/Project/etc/nail.txt
EX. to view the file contents
less /media/bob/windows/Users/GACHIO/wamp/www/Project/etc/nail.txt

Linux Symbolic link to Mapped Drive

I was wonder how I would be able to create a Symbolic link to a directory on a mapped drive?
I have a Mac OS laptop and have a mapped drive pointing to a folder on a remote server which contains a folder called 'content'.
I am able to access the mapped drive via Terminal and also it the directories without however when I try to create a symbolic link on my laptop ROOT directory pointing to the 'content' folder on the mapped drive then I get an error.
Here is the command I issue:
ln -s ./site_content /Volumes/***ip-address***/content
I then get the following error:
ln: /Volumes/***ip-address***/content/site_content: Input/output error
Any ideas?
Thanks!
Your command is backwards. The first path is the target of the link, and the second is where the link is created. If you did not specify where the link is created, it would default to the current directory and the name of the target (e.g. ./content).
ln -s /Volumes/***ip-address***/content ./site_content
You get an error with the previous command because however your drive is mapped, it does not support creating symbolic links on the remote filesystem. What you really wanted was a symbolic link on the local filesystem that references a remote filesystem, which should work fine.

phpstorm write issues in ./idea directory

When I try to save a file to disc within a project directory, I get this error:
java.io.IOException: W:\\[projectname]\\.idea not found
Some research tells me, the (network) location is not writable.
I'm trying to write this file from phpstorm in windows 8.
The drive (W:) is a network drive to a linux machine.
The directory I try to write to is chowned to the same user and group as I connect with in windows.
This is a result of ls -alh:
drwxrwxrwx 2 correct-user correct-user
On Linux and other Unix-like operating systems files starting with a . are considered 'hidden files' by default. As such, when the Windows-based program creates it, it suddenly doesn't see it anymore right after since it's hidden, even though the creation was successful. You can fix this in your Samba config by adding the following line to the share configuration:
hide dot files = no
In my samba settings I added a veto files parameter. Removing this parameter allows me to write dot files again.
Samba describes this setting as follows:
This is a list of files and directories that are neither visible nor accessible

Resources