分配文件關鍵字以便以後輕鬆找到它們

分配文件關鍵字以便以後輕鬆找到它們

假設我有一個文件。該文件儲存在一些複雜的位置(在一百個子資料夾內),但我仍然經常使用它。有沒有某種方法可以為此文件分配一組關鍵字(即“我最喜歡的文件”),然後稍後在某些自然語言處理器(命令行界面或語音識別軟體)中輸入這些關鍵字以開啟該文件?就像我可能會在命令列中輸入“打開最喜歡的文件”,或者我可能會在語音識別軟體中說“打開我最喜歡的文件”。

有這樣的服務嗎?

答案1

是的,它確實:

  1. 按照 @emory 的說明建立指向它的連結。

  2. 使其成為環境變數。將此行加入到 shell 的初始化檔案中(~/.bashrc如果您使用的是 bash):

    myfile =“/荒謬/長/路徑/那個/你/會/而不是/類型/每次/時間”

    然後,從命令列,您可以$myfile像實際檔案名稱一樣使用:

    $ echo $myfile 
    /absurdly/long/path/that/you/would/rather/not/type/every/time
    $ cat > $myfile 
    This is so much easier now!
    $ cat $myfile 
    This is so much easier now!
    
  3. 如果您將該檔案用於特定目的,例如,您只需將cat其傳送到終端,那麼您也可以設定一個別名來執行相同的操作。將其添加到 shell 的初始化檔案中:

    alias myfile='cat /absurdly/long/path/that/you/would/rather/not/type/every/time'
    

    然後,運行它:

    $ myfile 
    This is so much easier now!
    

答案2

你能創建一個符號連結嗎

ln -sf /some/complex/location/1/2/{your complex directory structure}/100/FavoriteFile /home/me/Desktop/FavoriteFile

該文件仍然位於其複雜的位置,但可以從您的桌面存取。

答案3

ctags 或許可以幫助你。它的創建是為了索引計算機原始碼文件,並可以輕鬆地定位函數或例程,並且需要確切地知道哪個文件包含它或該文件所在的位置。

手冊頁摘錄:

   Tag index files are supported by numerous editors, which allow the user
   to locate the object associated with a name appearing in a source  file
   and jump to the file and line which defines the name. Those known about
   at the time of this release are:

   Vi(1) and its derivatives (e.g. Elvis, Vim,  Vile,  Lemmy),  CRiSP,
   Emacs, FTE (Folding Text Editor), JED, jEdit, Mined, NEdit (Nirvana
   Edit), TSE (The SemWare Editor), UltraEdit, WorkSpace, X2, Zeus

   Ctags is capable of generating different kinds of tags for each of many
   different  languages.  For  a complete list of supported languages, the
   names by which they are recognized, and the kinds  of  tags  which  are
   generated  for each, see the --list-languages and --list-kinds options.

祝你好運。

相關內容