Mac OS中显示及隐藏文件和文件夹的方法

 Mac有一个设计原则,就是用户不需要看到的或者用户不希望看到的,都不会显示出来。但如果你想要修改其中某些文件,也是可以的,先需要显示所有的文件,可以在终端中输入命令行来实现。
显示系统隐藏的文件
    defaults write com.apple.finder AppleShowAllFiles -bool true
    KillAll Finder
    或者
    defaults write com.apple.finder AppleShowAllFiles YES
    KillAll Finder
    同样可以把这些隐藏文件再隐藏起来
    defaults write com.apple.finder AppleShowAllFiles -bool false
    KillAll Finder
    或者
    defaults write com.apple.finder AppleShowAllFiles NO
    KillAll Finder
在显示了所有文件之后,那如何把一个不是隐藏的文件修改为隐藏呢,下面介绍两种简单的方法。
方法一:直接在文件或文件夹名前面的加一个‘.’点号,然后系统会弹出修改确认对话框,点好就行了。
方法二:利用命令“chflags hidden” 可以隐藏文件或文件夹。
先打开Terminal(Applications/Utilities/Terminal),然后执行命令
chflags hidden 文件路径 或
chflags hidden 文件夹路径
既可。也可以先输入chflags hidden,然后直接把要隐藏的文件用鼠标选中拖到输入框中,它自动会转换为文件的路径。
要解除文件的隐藏状态,可以使用命令:
chflags nohidden
与前面相对应即可。
上面两种方式,到底有啥区别呢,个人觉得方法一并没有修改文件本身的属性,在linux及unix中,约定好点开头的文件就是隐藏文件。
方法二中修改的是文件本身的隐藏标志,但貌似在windows上不起作用,只能在linux及unix中有用。而方法一,windows也是可以显示
隐藏的,应该是windows也识别linux及unix中的点号约定。
在网上还发现有一个可以隐藏文件及文件夹的开源工程,提供了一个带界面的程序,可以方便不会使用命令行的用户,地址是https://code.google.com/p/hideme4mac/
最后,附加上chflags命令的详细信息。
chflags 命令修改文件的标志(change file flags),包括隐藏标志,其详细使用方法如下:
    SYNOPSIS
    chflags [-fhv] [-R [-H | -L | -P]] flags file ...
    DESCRIPTION
    The chflags utility modifies the file flags of the listed files as specified by the flags operand.
    The options are as follows:
    -f Do not display a diagnostic message if chflags could not modify the flags for file, nor modify
    the exit status to reflect such failures.
    -H If the -R option is specified, symbolic links on the command line are followed. (Symbolic
    links encountered in the tree traversal are not followed.)
    -h If the file is a symbolic link, change the file flags of the link itself rather than the file
    to which it points.
    -L If the -R option is specified, all symbolic links are followed.
    -P If the -R option is specified, no symbolic links are followed. This is the default.
    -R Change the file flags for the file hierarchies rooted in the files instead of just the files
    themselves.
    -v Cause chflags to be verbose, showing filenames as the flags are modified. If the -v option is
    specified more than once, the old and new flags of the file will also be printed, in octal
    notation.
    The flags are specified as an octal number or a comma separated list of keywords. The following key-
    words are currently defined:
    arch, archived
    set the archived flag (super-user only)
    opaque set the opaque flag (owner or super-user only). [Directory is opaque when viewed through
    a union mount]
    nodump set the nodump flag (owner or super-user only)
    sappnd, sappend
    set the system append-only flag (super-user only)
    schg, schange, simmutable
    set the system immutable flag (super-user only)
    uappnd, uappend
    set the user append-only flag (owner or super-user only)
    uchg, uchange, uimmutable
    set the user immutable flag (owner or super-user only)
    hidden set the hidden flag [Hide item from GUI]
    As discussed in chflags(2), the sappnd and schg flags may only be unset when the system is in single-
    user mode.
    Putting the letters ``no'' before or removing the letters ``no'' from a keyword causes the flag to be
    cleared. For example:
    nouchg clear the user immutable flag (owner or super-user only)
    dump clear the nodump flag (owner or super-user only)
    Unless the -H or -L options are given, chflags on a symbolic link always succeeds and has no effect.
    The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options
    override each other and the command's actions are determined by the last one specified.
    You can use "ls -lO" to see the flags of existing files.
下面提供一个中文版
    chflags
    名称:
    chflags – 改变文件的标志
    概述:
    chflags [-fhv] [-R [-H | -L | -P]] 标志 文件
    描述:
    工具chflags修改指定文件的文件标志。
    选项如下:
    -f 如果chflags不能修改文件标志,nor modify the exit status to reflect such failures,则不显示诊断信息。
    -H 如果开启-R选项,将改变软连接指向的文件的文件标志(遍历树中的软连接除外)。
    -h 如果文件是软连接,只改变该链接的文件标志,而不改变该链接所指向的文件的标志。
    -L 如果-R选项开启,将改变所有软连接所指向的文件的文件标志。
    -P 如果-R选项开启,将不改变所有软连接所指向的文件的文件标志。这是默认选项。
    -R Change the file flags for the file hierachies rooted int the files instead of just the files themselves.
    -v 当修改标志时显示文件名。如果 –v 出现两次以上,则以八进制同时显示旧标志和新 标志。
    文件标志以一个八进制数或一系列以逗号分隔的关键词来显示。下面是当前定义的关 键词:
    arch,archived
    存档文件标志(超级用户独有)
    opaque 不透明文件标志(适用于文件所有者或超级用户)
    nodump nodump文件标志(适用于文件所有者和超级用户)
    sappnd,sappend
    仅允许附加 文件标志(超级用户独有)
    schg,schange,simmutable
    不可更改 文件标志(超级用户独有)
    sunlnk,sunlink
    不可删除 文件标志(超级用户独有)
    uappnd,uappend
    只允许用户附加 文件标志(适用于所有者和超级用户)
    uchg,uchange,uimmutable
    不允许用户更改 文件标志(适用于所有者和超级用户)
    uunlnk,uunlink
    不允许用户删除 文件标志(适用于所有者和超级用户)
    在关键词前面添加或者去除“no”将清除相应的文件标志。例如:
    nouchg 清除 不可更改 文件标志(适用于所有者或超级用户)
    dump 清除 nodump 文件标志(适用于所有者或超级用户)
    八进制数值对应的文件标志:
    0 清除所有文件标志
    1 nodump
    2 uchg
    3 uchg,nodump
    4 uappnd
    10 opaque
    20 uunlnk
    Other combinations of keywords may be placed by using the octets assigned.但是,以上这些是最常用的。
    你可以使用 “ls -lo”来查看文件的文件标志。
    注意:能否改变某些标志依赖于当前内核的安全级别设定。查看security(7)来获得更多的 信息。
    退出状态:
    成功 0,失败>0.
    实例:
    无
    参考:
    ls(1), chflags(2), stat(2), fts(3), security(7), symlink(7)
    标准:
    无
    历史:
    chflags最早出现在4.4BSD当中。
    BUGS:
    Only a limited number of utilities are chflags aware. Some of these
    tools include ls(1), cp(1), find(1), install(1), dump(8), and restore(8).
    In particular a tool which is not currently chflags aware is the pax(1)
    utility.chio
————————————————
版权声明:本文为CSDN博主「lipingqingqing」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lipingqingqing/article/details/8844797

使用优化算法,以优化VMD算法的惩罚因子惩罚因子 (α) 和分解层数 (K)。 1、将量子粒子群优化(QPSO)算法与变分模态分解(VMD)算法结合 VMD算法背景: VMD算法是一种自适应信号分解算法,主要用于分解信号为不同频率带宽的模态。 VMD的关键参数包括: 惩罚因子 α:控制带宽的限制。 分解层数 K:决定分解出的模态数。 QPSO算法背景: 量子粒子群优化(QPSO)是一种基于粒子群优化(PSO)的一种改进算法,通过量子行为模型增强全局搜索能力。 QPSO通过粒子的量子行为使其在搜索空间不受位置限制,从而提高算法的收敛速度与全局优化能力。 任务: 使用QPSO优化VMD的惩罚因子 α 和分解层数 K,以获得信号分解的最佳效果。 计划: 定义适应度函数:适应度函数根据VMD分解的效果来定义,通常使用重构信号的误差(例如均方误差、交叉熵等)来衡量分解的质量。 初始化QPSO粒子:定义粒子的位置和速度,表示 α 和 K 两个参数。初始化时需要在一个合理的范围内为每个粒子分配初始位置。 执行VMD分解:对每一组 α 和 K 参数,运行VMD算法分解信号。 更新QPSO粒子:使用QPSO算法更新粒子的状态,根据适应度函数调整粒子的搜索方向和位置。 迭代求解:重复QPSO的粒子更新步骤,直到满足终止条件(如适应度函数达到设定阈值,或最大迭代次数)。 输出优化结果:最终,QPSO算法会返回一个优化的 α 和 K,从而使VMD分解效果最佳。 2、将极光粒子(PLO)算法与变分模态分解(VMD)算法结合 PLO的优点与适用性 强大的全局搜索能力:PLO通过模拟极光粒子的运动,能够更高效地探索复杂的多峰优化问题,避免陷入局部最优。 鲁棒性强:PLO在面对高维、多模态问题时有较好的适应性,因此适合海上风电时间序列这种非线性、多噪声的数据。 应用场景:PLO适合用于优化VMD参数(α 和 K),并将其用于风电时间序列的预测任务。 进一步优化的建议 a. 实现更细致的PLO更新策略,优化极光粒子的运动模型。 b. 将PLO优化后的VMD应用于真实的海上风电数据,结合LSTM或XGBoost等模型进行风电功率预测。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值