如果您為工作設定了大量資料夾,並且在工作日需要在所有資料夾中使用相同的指令碼檔案,那麼除了大量複製和貼上之外,最簡單的方法是什麼?今天的超級使用者問答帖子為沮喪的讀者提供了一些有用的答案和建議。
今天的問答環節是由SuperUser提供的,SuperUser是Stack Exchange的一個分支,是一個由社群驅動的問答網站分組。
由csaveanu(Flickr)提供的螢幕截圖。
超級使用者閱讀器Elliot正在尋找讓同一個檔案同時出現在多個資料夾中的最佳方法:
I have 50+ folders, each of which contains a large amount of data that needs to be processed. All of them are processed using the same exact code, utilizing os.path.dirname(os.path.realpath(file)) to get the directory in which the python script is located so there is no manual editing needed by the user, they just need to double click.
I need the script to appear as if it is in each folder while actually being in only one place so that I can edit it once, then when it is run from any of these locati*** have the folder path be correct. The alternative is editing the master and then pasting it one folder at a time through all 50+ folders every time I update the code, which is very tedious and error prone. On Linux, I could set this up with a symbolic link, but I cannot figure out a way to do this with Windows.
Alternatively, a way to paste the file into all the target directories at once, instead of one at a time, would accomplish the same goal.
有沒有辦法做到這一點,而不是複製和貼上指令碼檔案一次一個資料夾?
超級使用者貢獻者gronostaj為我們提供了以下答案:
You need a Symbolic Link or a Hard Link.
Symbolic Links (or Symlinks for short) are quite similar to shortcuts: there is one actual file and multiple references (Symlinks) to it. They even have that little arrow on the ic***. Unlike shortcuts, Symlinks can have any extension.
Hard Links bind a file on a hard drive to a location in the directory tree. Each file has at least one Hard Link, otherwise it would not exist in any directory. If a file has multiple Hard Links, the original one cannot be distinguished from the others and the file physically exists in only one location.
Both Have Their Limitati***:
Symlinks are usually sufficient.
To Create a Symlink or a Hard Link:
1. Launch a privileged command line: Press the Windows Key, type cmd, then press Ctrl+Shift+Enter.
2. Issue the mklink command:
有什麼要補充的解釋嗎?在評論中發出聲音。想從其他精通技術的Stack Exchange使用者那裡瞭解更多答案嗎?在這裡檢視完整的討論主題。
... 如何使用谷歌硬碟?你有什麼我們沒有列出的最喜歡的功能嗎?請在下面的評論中與我們分享您的建議。 ...
...文件、儲存檔案、與其他人協作以及匯出文件。下面介紹如何在iOS 11中使用新的檔案應用程式。 ...
... 每次我想在開啟一個檔案之前預覽它,我都會導航到它在Finder中的位置,以使用快速查詢功能。我從來沒有想過,我可以預覽檔案,因為我開啟他們,即從開啟對話方塊。事後看來,這似...
...)。在此期間,應用程式在ProgramFiles資料夾中為自己建立一個條目,添加註冊表值,並執行它需要在系統上正常工作的其他任務。 ...
...動圖示上拖放檔案或資料夾以開始處理它們。您可以定義如何按名稱、大小、日期、屬性篩選檔案,並關聯要執行的21個可用操作之一。它支援上傳、重新命名、加密、壓縮、更改屬性等操作。 ...
...用程式,而是一個深入整合到Finder應用程式中的功能。 如何在mac上壓縮檔案和資料夾 要開始,請開啟“Finder”應用程式,找到要壓縮的檔案或資料夾。如果要選擇多個檔案,請在選擇檔案時按住Command鍵。 一旦你做了選擇,右...
...方法。我們將向您展示檔案資源管理器的所有技巧,以及如何在命令提示符和PowerShell中使用它們。您甚至可以將“複製到”和“移動到”新增到檔案資源管理器的上下文選單中。 在Windows 10中複製檔案或資料夾時,所選專案將被...
...每次只需增加資料夾名稱中不可見空格的數量。 相關:如何隱藏每個作業系統上的檔案和資料夾 這是不安全的,可能是小車 顯然,這不是一種隱藏檔案的安全方法。任何人都可以透過系統搜尋找到不可見資料夾的內容。有人...