这是一个很好的问题,我也在寻找类似的东西,但我很确定 Nautilus 中已经内置了类似的东西,
但如果您可以编写一些脚本,您就可以相对轻松地调整 Nautilusfile Notes来执行类似的操作。这将需要一些基本的(+?)脚本编写..
file Notes您可以将注释添加到目录和文件中 。
在注释中搜索特定标签,然后使用“注释”中的匹配标签创建指向每个目录的临时链接(或永久链接),这将是一个简单的问题...然后将这些链接放入“搜索”中results' 目录...然后您将在 Nautilus 窗口中显示该目录!...
如果我有空闲时间,我会自己做,但相反,这是我编写的用于访问、写入和删除 Nautilus Notes 的脚本。它没有执行我上面描述的操作,但它确实显示了如何访问Notes 数据缓存。该脚本旨在供以下人员使用nautilus-actions
该脚本位于Pastbin.ubuntu.com
更新:我现在已经编写了一个使用如上所述链接的工作脚本。但是,我现在已经交换了“nautilus Notes”想法并移植到用户未知的.tag 文件中。(所以,如果您喜欢该脚本,请记住 .tag 的想法是“用户未知”) ..
我喜欢纯文本文件(它们简单、通用且非常易于使用)
我用作locate搜索工具,因为它速度超快,但它是仅与上次运行时一样最新updatedb(通常是每天运行,但您可以随时运行)。
我试图在评论中解释脚本的用法,但我应该指出它没有经过充分测试,因此它可能在一些小问题上出现错误。
它删除/删除的唯一内容是临时目录和任何软链接它包含... 请注意,删除软链接不会删除目标/数据目录。
这是脚本
UPDATE2:(修复了一个错误。它只处理前 100 个定位的 .tag 文件)
#!/bin/bash
# Script: dirtags ...(by fred.bear)
#
# Summary: Open the file browser in a temporary directory
# which contains soft-links to directories whose
# '.tag' file contains the search string in $1
#
# .tag files are files you create in any directory which
# you wish to *tag*.
#
# .tag files are simple free form text, so you can
# put anything you like in them...
#
# The script uses `locate` to create a list of .tag file
# 'locate' is very fast, but because it depends on 'updatedb'
# for its list of current files, it can be a bit out of sync
# with a newly added .tag file... Modifying an existing
# .tag file does not effect `locate`
# To refresh the `locate` database, just run 'sudo updatedb'
# .. (updatedb typically auto-runs once a day, but you should check)
#
# Note: The search result soft links are put into a temporary directory
# This directory is removed each time you run the script
# TODO: allow saved searches (?) maybe
#
# Note: With nautilus, running the script a second time while
# the previoulsy opened wiondow is still open, cause the
# second window to open in its parent directory: /tmp/$USER
# ... but you can then just enter the 'dirtags' dir
# you see listed /tmp/$USER/$bname
# TODO: this probably happens because currently the
# directory is being removed each time the script
# is run... (related to "allow saved searches")
#
# A sample usage of this script:
#
# 1. Make a '.tag' file in each of several test directories.
# 2, For this first-time test, run 'sudo updatedb' so that the
# newly added .tag files are added to the 'locate's database
# 3. In each .tag file, put some tags (words or phrases to serch for)
# eg; action comedy drama good bad sci-fi documentary
# 4. Run this script with a single argument.. (a grep regex)
# eg "action|comedy"
#
function args_grep_links {
# $1 -- the grep regex
##echo grep -l '"'$1'"' ${tagged[@]}
< <(eval grep -l '$1' ${tagged[@]}) \
sed "s/^\(.*\)\/\.tag/ln -s \"\1\" $tagdbs/" \
>>"$tagdir"/.tag.slinks
##(gedit "$tagdir"/.tag.slinks &)
# make the soft links
source "$tagdir"/.tag.slinks
rm "$tagdir"/.tag.slinks
unset tagged
aix=
}
# Identity the script
bname="$(basename "$0")"
# Syntax
if [[ "$1" == "" ]] ; then
echo "ERROR: $bname requires one arg; a 'grep' regular expression string"
echo " eg: $bname \"music\" ......... Any instance of \"music\" .....(eg: \"musical\")"
echo " eg: $bname \"\<music\>\" ..... Only the word \"music\" ...(but not \"musical\")"
echo " eg: $bname \"muscic\|action\". Any instance of \"music\" or \"action\")"
exit 1
fi
# 'locate' the .tag files
# =======================
tagdir="/tmp/$USER/$bname"
tagdbs="${tagdir//\//\/}"
[[ -d "$tagdir" ]] && rm -rf "$tagdir" # remove all
[[ ! -d "$tagdir" ]] && mkdir -p "$tagdir" # fresh start
cp /dev/null "$tagdir"/.tag.slinks
unset tagged # array of .tag files
aix=0 # arg index
amax=10 # arg max per call to grep
fct=0 # file count
while IFS= read -r file ; do
tagged[$aix]="$file"
####echo ${tagged[aix]}
((aix++));((fct++))
(( aix == amax )) && args_grep_links "$1"
done < <(locate -ber ^\.tag$ |sed "s/.*/\"&\"/")
(( aix < amax )) && args_grep_links "$1"
sleep 1 # to allow time for rm to settle down after rm and adding links
xdg-open "$tagdir"
exit
#
Run Code Online (Sandbox Code Playgroud)
您可以添加一个文件,例如
.tag
Run Code Online (Sandbox Code Playgroud)
进入每个文件夹。您可以在那里将信息存储为文本。您稍后可以浏览它们以获取信息。
也许您更适合使用find之类的工具。
请随意询问它的用法。