symlink

Docker and symlinks

随声附和 提交于 2019-12-18 11:01:43
问题 I've got a repo set up like this: /config config.json /worker-a Dockerfile <symlink to config.json> /code /worker-b Dockerfile <symlink to config.json> /code However, building the images fails, because Docker can't handle the symlinks. I should mention my project is far more complicated than this, so restructuring directories isn't a great option. How do I deal with this situation? 回答1: Docker doesn't support symlinking files outside the build context. Some different methods for using a

`os.symlink` vs `ln -s`

风流意气都作罢 提交于 2019-12-18 10:48:14
问题 I need to create a symlink for every item of dir1 (file or directory) inside dir2. dir2 already exists and is not a symlink. In Bash I can easily achieve this by: ln -s /home/guest/dir1/* /home/guest/dir2/ But in python using os.symlink I get an error: >>> os.symlink('/home/guest/dir1/*', '/home/guest/dir2/') Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 17] File exist I know I can use subprocess and run ln command. I don't want that solution. I'm also

Getting the logical path in VIM when there's a symlink

久未见 提交于 2019-12-18 05:51:52
问题 I have the following setup: mkdir /1 mkdir /1/2 mkdir /1/2/3 ln -s /1/2/3 /1/3 If I do cd /1/3 , and then pwd , I get /1/3 . If I use pwd -P , I can get /1/2/3 , or pwd -L to force /1/3 . In VIM, I'm looking for a way to get the /1/3 . If I open a file in /1/3/foo.txt , and I use something like fnamemodify(bufname(winbufnr(0)), ':p:h') , it returns /1/2/3 . How can I tell it to give me the same directory that pwd would give? 回答1: It appears you can't, other than via system('pwd -L') .

What is there behind a symbolic link?

拈花ヽ惹草 提交于 2019-12-18 03:06:09
问题 How are symbolic links managed internally by UNIX/Linux systems. It is known that a symbolic link may exist even without an actual target file (Dangling link). So what is that which represents a symbolic link internally. In Windows, the answer is a reparse point . Questions: Is the answer an inode in UNIX/Linux? If yes, then will the inode number be same for target and links? If yes, can the link inode can have permissions different from that of target's inode (if one exists)? 回答1: It is not

Find out whether a file is a symbolic link in PowerShell

蹲街弑〆低调 提交于 2019-12-18 01:43:50
问题 I am having a PowerShell script which is walking a directory tree, and sometimes I have auxiliary files hardlinked there which should not be processed. Is there an easy way of finding out whether a file (that is, System.IO.FileInfo ) is a hard link or not? If not, would it be easier with symbolic links (symlinks)? 回答1: Try this: function Test-ReparsePoint([string]$path) { $file = Get-Item $path -Force -ea SilentlyContinue return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)

Find out whether a file is a symbolic link in PowerShell

*爱你&永不变心* 提交于 2019-12-18 01:42:08
问题 I am having a PowerShell script which is walking a directory tree, and sometimes I have auxiliary files hardlinked there which should not be processed. Is there an easy way of finding out whether a file (that is, System.IO.FileInfo ) is a hard link or not? If not, would it be easier with symbolic links (symlinks)? 回答1: Try this: function Test-ReparsePoint([string]$path) { $file = Get-Item $path -Force -ea SilentlyContinue return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)

how to find the target file's full(absolute path) of the symbolic link or soft link in python

余生长醉 提交于 2019-12-17 22:55:03
问题 when i give ls -l /etc/fonts/conf.d/70-yes-bitmaps.conf lrwxrwxrwx <snip> /etc/fonts/conf.d/70-yes-bitmaps.conf -> ../conf.avail/70-yes-bitmaps.conf so for a symbolic link or soft link, how to find the target file's full(absolute path) in python, If i use os.readlink('/etc/fonts/conf.d/70-yes-bitmaps.conf') it outputs ../conf.avail/70-yes-bitmaps.conf but i need the absolute path not the relative path, so my desired output must be, /etc/fonts/conf.avail/70-yes-bitmaps.conf how to replace the

symbolic link: find all files that link to this file

坚强是说给别人听的谎言 提交于 2019-12-17 21:27:46
问题 Hallo all, I need to do this in linux: Given: file name 'foo.txt' Find: all files that are symbolic links to 'foo.txt' How to do it? Thanks! 回答1: It depends, if you are trying to find links to a specific file that is called foo.txt, then this is the only good way: find -L / -samefile path/to/foo.txt On the other hand, if you are just trying to find links to any file that happens to be named foo.txt , then something like find / -lname foo.txt or find . -lname \*foo.txt # ignore leading

Creating hard and soft links using PowerShell

孤街浪徒 提交于 2019-12-17 21:25:02
问题 Can PowerShell 1.0 create hard and soft links analogous to the Unix variety? If this isn't built in, can someone point me to a site that has a ps1 script that mimics this? This is a necessary function of any good shell, IMHO. :) 回答1: You can call the mklink provided by cmd , from PowerShell to make symbolic links: cmd /c mklink c:\path\to\symlink c:\target\file You must pass /d to mklink if the target is a directory. cmd /c mklink /d c:\path\to\symlink c:\target\directory For hard links, I

android: determining a symbolic link

柔情痞子 提交于 2019-12-17 19:45:09
问题 I am scanning all directories starting from "/" to find some particular directories like "MYFOLDER". However, the folder is that I get double instances of the same folder. This occurs because one folder is located in "/mnt/sdcard/MYFOLDER" and the same folder has a symbolic link in "/sdcard/MYFOLDER".. My Question is, "Is there any way to determine whether the folder is a symbolic link or not?". Please give me some suggestions.. 回答1: This is essentially how they do in Apache Commons (subject