Skip to content

BenjaminOddou/alfred-file-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

logo-dark

logo-light

made with heart by Benjamin Oddou saythanks Python 3.6+

Welcome to the File Explorer repository: An Alfred Workflow ✨

βœ… Prerequisites

⬇️ Installation

  1. Download the workflow
  2. Double click the .alfredworkflow file to install

πŸ§™β€β™‚οΈ Invoke the workflow

There is 2 flows in this workflow :

  1. The first one allows you to grab filenames. It can be triggered by writing getfilenames keyword.
  2. The second allows you to rename files based on the data in a selected spreadsheet. You can invoke this flow with the renamefiles keyword.

You can edit these triggers (flagged with a πŸ•ΉοΈ symbol) in the user configuration panel.

🧰 Setup the workflow

  1. Install Python 3.6 or above. Check your version with :
python --version

πŸ€– Usage of the workflow

Register filenames in a Spreadsheet

Ensure that you select the right Level for the parameter πŸ” Depth of the search. If you want to include files in subdirectories increase the depth level.

Optionally, you can write a regex expression to the 🚫 Reject Files parameter. If the files matches you regex parameter, it will be excluded from the result. For example the following regex expression ^\.|^\~|desktop\.ini will allow you to exclude common hidden and temp files.

Note that if you let it empty, all files will be listed

Using Workflow File Filter

Invoke the first flow with the πŸ•ΉοΈ Trigger 1 and search for the folder or the file you want to register the filenames of and press ⏎.

normal_search

Alternatively, use the Alfred Buffer to select folder(s) and files(s) at the same time !! Basic commands are :

  • βŒ₯↑ to add a file to the buffer from Alfred's results.
  • βŒ₯↓ to add a file and move to the next item in your list of results.
  • βŒ₯← to remove the last item from the buffer.
  • βŒ₯β†’ to action all items in the buffer.
  • βŒ₯⌫ to remove all items from the buffer.

To know more on how to use Alfred Buffer, follow this link.

Note that Alfred Buffer is preferred compare to the {query}, meaning that if you select a folder/file (by clicking on it or by pressing enter ⏎) that is not included in the buffer, it will not be included in the xlsx file.

alfred_buffer

Using Alfred Universal Actions

Select the folder(s) / files(s) you want to grab the name of within alfred using Quick Search and run Universal Actions with β†’ or βŒ₯β†’ if you used the Alfred buffer. Select "Get filenames in a spreadsheet".

universal_action

If you want to know more on how to use Alfred Universal Actions, follow this link.

Renaming files

Edit the column D of the xlsx generated file with new filenames and include file extension. Please, don't insert, delete, or edit any other columns.

Note that changing a file extension (png to jpg for example) can potentially break the file ! You can prevent this by ticking the πŸ›‘οΈ Safe renaming. If you still want to change the file extension (jpg to JPEG for example), untick it.

Invoke the second flow with the πŸ•ΉοΈ Trigger 2 and select the xlsx file that should be used for the renaming operation and press ⏎. Hold the ⌘ key and press ⏎ to reveal the file in the finder. Alternatively you can open the file in the default application by pressing βŒ₯⏎.

rename_xlsx_selection

Review your parameters and launch the renaming operation by selecting Rename Files.

Note that if you want to change back from new names (in column D) to old names (columns B+C), you can tick the ⏳ Reverse names checkbox`.

rename_params

Logs output

Check the logs of your compression under the Data folder. The log file can contains two types of messages :

  1. If everything went well you'll have the following message : INFO:root:βœ… Renaming successful: {old_file} β‡’ {new_file}
  2. If an error occurs, you'll have : INFO:root:🚨 Error renaming {old_file}: {error_description}

Note that renaming operation will always create a log file that is named {name_of_the_excel_file}{log_timestamp}.log

βš–οΈ License

MIT License Β© Benjamin Oddou