file-arranger

Simple & capable File/Directory arranger/cleaner
授权协议 GPL-3.0 License
开发语言 C/C++
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 邬承悦
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Arranger

Simple & Capable files arranger

About

Arranger is a CLI file arranger written in Perl
It cleans up your Directory by moving files to their corresponding Directory by their file extension
jpg, png, jpeg webp -> Images
mp4, mkv, avi, flv -> Videos
and other common filetype extensions

Features

Arranger can

  • control maxdepth when arranging
  • delete empty Directories
  • save logs of what exactly happened
  • revert the move using logfile
  • move only specific files by provided file extensions & Directory
  • arrange more than one Directory
  • move unrecognised filetypes to 'Other' Directory
  • arrange files by patterns

Installation

Its just a perl scriptdownload it make it executable and put somewhere in your $PATH

Via install script

bash -c "$(curl https://raw.githubusercontent.com/anhsirk0/file-arranger/master/install.sh)"

Manually

with wget

wget https://raw.githubusercontent.com/anhsirk0/file-arranger/master/arranger.pl -O arranger

or

with curl

curl https://raw.githubusercontent.com/anhsirk0/file-arranger/master/arranger.pl --output arranger

making it executable

chmod +x arranger

copying it to $PATH (~/.local/bin/ , this step is optional)

cp arranger ~/.local/bin/

Usage

arranger [dirs] [options]

will arrange current Directory
see examples for detailed usage

Screenshots

arranger with no arguements

arranger moving specific files to provided dir

arranger -ext py -dir Python

arranger reversing the move via a logfile

arranger -rev -logfile arrange_log

arranger not saving logs and not moving unrecognised filetypes to 'Other'

arranger -no-log -no-unknown

arranger arranging given Directories

arranger folder1 folder2

arranger dry-run

arranger -dry-run

arranger name/iname

arranger -name "Episode." -dir "Episodes"arranger -iname "episode." -dir "Episodes"

Examples

arranger mydir1 mydir2 mydir3

will arrange mydir1 mydir2 mydir3 Directories one by one

arranger -no-log

arrange current Directory and wont save logfile

arranger -delete-empty

arrange current Directory and also delete empty Directories

arranger -delete-empty -no-arrange

only delete empty Directories , wont arrange

arranger -no-unknown

arrange current Directory and wont move files with unrecognised extensions

arranger -ext pl -dir "Perl"

move all files with pl extension to Directory 'Perl'

arranger -ext jpg png jpeg svg -dir "Images"

move all files with any of {jpg, png, jpeg, svg} extension to Directory 'Images'

arranger -name ".*Season.*1.*" -dir "Season_1"
arranger -iname ".*season.*1.*" -dir "Season_1"
arranger -iname "episode.*" ".*part.*" -name ".*Videos.*" -dir "Episodes_Parts_and_Videos"

move all files with given regex pattern to Directory 'Season_1'
name for case sensitive regex matches and iname for case insensitive
you can use multiple patterns for both -name and -iname
you dont need to specify ^ (start of line) and $ (end of line)
You should be careful while using name/iname , it doesnot match wildcards
It only match regex patterns

Tweaking arranger via config file

you need to create a file ~/.config/arranger/arranger.conf

you can download the sample config file and move it into the config Directory

wget https://raw.githubusercontent.com/anhsirk0/file-arranger/master/arranger.conf

or

with curl

curl https://raw.githubusercontent.com/anhsirk0/file-arranger/master/arranger.conf --output arranger.conf

move to config dir

mv arranger.conf ~/.config/arranger/arranger.conf

About config file

  • everything should be space separated (don't worry about extra/trailing spaces)
  • first word of line would be Directory name rest would be file extensions associated with that Directory

Available options

-m or --maxdepth=INT specify maxdepth (> 1)
-h or --help show this help message
-dry or --dry-run show what will happen without actually arranging
-v or --verbose print file name while moving
-rev or --revert revert the move (require a logfile)
-log or --logfile=STR specify logfile (required for reverting)
-no-log dont save log
-no-unknown dont move unrecognised filetypes
-no-arrange dont move any file (helpful if you only want to delete empty dirs)
-delete-empty delete empty directories (if any)
-ext or --extensions=STRs specify extension(s) to move (requires a Directory)
-name=STRs specify patterns (case sensitive) to move files (requires a Directory)
-iname=STRs specify patterns (case insensitive) to move files (requires a Directory)
-dir or --directory=STR specify the Directory to move files in (required by -ext/name/iname)

 相关资料
  • File An API to read, write and navigate file system hierarchies, based on the W3C File API. Objects DirectoryEntry DirectoryReader File FileEntry FileError FileReader FileSystem FileTransfer FileTrans

  • fis.file~ File new File(propsopt) File,fis 编译过程中,文件会被此类进行封装,对于文件的操作,都是通过此类来完成。 Parameters: Name Type Attributes Description path... String 文件路径,可以作为多个参数输入,多个参数会被 / 串联起来。 props Object <optional> 可以默认给文

  • fis. file 用来创建 File 对象, 更多细节请查看 File 说明。 var file = fis.file(root, 'static/xxx.js'); Source: file.js, line 690 See: File 类说明 Classes File Members (static) wrap 用来包裹文件,输入可以是路径也可以是文件对象,输出统一为文件对象。 Source

  • 文件操作. 支持 安装 $ npm install universal-file --save 方法 getInfo(options) 获取文件信息。 参数 属性 类型 默认值 必选 描述 支持 filePath String √ 文件路径 digestAlgorithm String md5 x 摘要算法,支持 md5 和 sha1 getSavedInfo(options) 获取保存的文件信息

  • This plugin implements a File API allowing read/write access to files residing on the device. This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/ The (n

  • 类名: Imi\Util\File 文件相关工具类 方法 enum 方法返回一个迭代器对象。 // 枚举当前目录及所有子目录中的文件,不包含.和.. foreach(File::enum(__DIR__) as $fileName) { echo (string)$fileName, PHP_EOL; } enumPHPFile 方法返回一个迭代器对象。 // 枚举当前目录及所有子目录中

  • 配置 <?php return [ 'caches' => [ // 缓存名称 'alias1' => [ // 缓存驱动类 'handlerClass' => \Imi\Cache\Handler\File::class, // 驱动实例配置

  • 描述: 描述一个文件。 别名: @fileoverview @overview Overview(概述) @file标签提供文件的说明。在文件开头的JSDoc注释部分使用该标签。 Example (例子) 例如,文件描述: /** * @file Manages the configuration settings for the widget. * @author Rowina Sanela