Filename Studio Code
Project description
🧩 FSCode (Filename Studio Code) — Manage Your Filesystem with Your Editor
Turn your VS Code / Vim into a file operations IDE. Generate safe, reviewable batch scripts (move/rename/copy/delete, etc.) from a "visual manifest".
🏁 Quick Start
pip install PyFSCode
find ./photos -name "*.jpg" | fscode --editor='code -w' *.txt
⚡️ Video Demo
🤔 Why This Tool?
Batch file operations (rename / move / delete) are the most common yet error-prone tasks in the command-line world:
mv,cp,rmcommands are very clumsy and error-prone for batch operations.- Manually writing
forloops andsedfor renaming carries a heavy mental load. - Swapping filenames is very complex and often impossible even in a GUI.
fscode provides a more powerful and unified solution.
🚀 What Can It Do?
fscode lets you use your editor to plan batch file operations and safely generate a script for execution.
✨ Core Features
- 🧭 Editor as UI — Use the powerful features of VS Code/Vim (multi-cursor, regex, macros) to manage files;
- 🧱 Smart Dependency Handling — Automatically resolves swap, cycle, and move conflicts;
- 🪶 Safe and Controllable — Does not modify files directly, only generates a reviewable file operation script;
- 💡 Full Operation Support — Supports creation, copying, moving, deleting, and renaming.
- Custom Commands - For example, you can replace
touchwithai-generateto create files with content. - Custom Command Prefix - For example, you can use
sudoas a prefix for the output script.
📦 Installation
pip install PyFSCode
# Or using uv
uv tool install PyFSCode
🧑💻 Usage Example
💻 Step 1: Input Files from Command Line
⚠️ [NOTE]: If your $VISUAL or $EDITOR environment variable points to VS Code, please use --editor='code -w' to wait for the window to close before continuing.
Method 1: Input from Pipe
find ./photos -name "*.jpg" | fscode
Method 2: Pass as Arguments
fscode *.jpg *.txt
Method 3: Pipe + Arguments
find ./photos -name "*.jpg" | fscode *.jpg *.txt
Method 4: Use Custom Commands (Advanced Users)
fscode --is_exchange --editor='code -w' --create='new' --remove='del' --move='mov' *.jpg
📄 Step 2: Modify Filenames in the Editor
The editor will open a file similar to this:
# <ID> <Path>
1 photos/vacation.jpg
2 photos/birthday.jpg
3 project/notes.txt
4 "photos/old picture.jpg"
You just need to modify it:
# File Operation Plan
# ... (comments omitted) ...
#
# My Modifications
# 1. Rename (Edit the path)
1 photos/Paris_Vacation_2025.jpg
# 2. Move (Edit the path)
3 archive/old_notes.txt
# 3. Copy (Duplicate the line, use the same ID 2)
2 photos/birthday.jpg
2 photos/backup_birthday.jpg
# 4. Delete (Delete or comment out the line with ID 4)
# 4 "photos/old picture.jpg"
# 5. Create (Add a new line, ID is 0, quotes are needed due to spaces)
0 "new_project/new note.txt"
⚡ Step 3: Execute
After saving and closing the editor, FSCode will generate a script:
#!/bin/sh
touch "new_project/new note.jpg"
cp photos/birthday.jpg photos/backup_birthday.jpg
mv photos/vacation.jpg photos/Paris_Vacation_2025.jpg
mv project/notes.txt archive/old_notes.txt
rm "photos/old picture.jpg"
After reviewing it for correctness, execute it:
source ./file_ops.sh
✅ All changes can be safely reviewed before execution.
📄 Help Documentation
INFO: Showing help with the command 'fscode -- --help'.
NAME
fscode - Main execution flow.
SYNOPSIS
fscode <flags> [PATHS]...
DESCRIPTION
Main execution flow.
POSITIONAL ARGUMENTS
PATHS
Type: str
File paths to process. Can be provided as arguments or via stdin.
FLAGS
--editor=EDITOR
Type: str
Default: 'code'
The editor command to use (e.g., "msedit", "code -w"). Defaults to $VISUAL, $EDITOR, or 'code -w'.
-o, --output_script=OUTPUT_SCRIPT
Type: str | pathlib._local.Path
Default: 'file_ops.sh'
Path to write the generated shell script.
--edit_suffix=EDIT_SUFFIX
Default: '.sh'
Suffix for the temporary editing file. Defaults to '.sh'.
-n, --null=NULL
Default: False
Whether to use null-separated input.
-r, --remove=REMOVE
Default: 'rm'
The command to use for remove operations.
--copy=COPY
Default: 'cp'
The command to use for copy operations.
--move=MOVE
Default: 'mv'
The command to use for move operations.
--create=CREATE
Default: 'touch'
--exchange=EXCHANGE
Default: 'mv --exchange'
The command to atomically swap filenames. If you modify to a custom command, is_exchange is automatically enabled.
--move_tmp_filename=MOVE_TMP_FILENAME
Type: Optional[str | None]
Default: None
Path for the temporary filename used during cycle move operations.
-i, --is_exchange=IS_EXCHANGE
Default: False
Use swap for circular moves and avoid using temporary files. Currently only higher versions of linux are supported.
--cmd_prefix=CMD_PREFIX
Type: Optional[str | None]
Default: None
An optional command prefix to prepend to all commands.
🌈 Other Recommended Tools
🐟 fish alias example
alias -s fscode "fscode --is_exchange --editor='code -w' --create='new' --remove='del' --move='mov'"
Appendix
🔗 Similar Projects
📄 License
This project is open-sourced under the MIT License.
🪶 Tips
Like this project? Please give it a ⭐️ Star. Your support helps more people discover it.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyfscode-0.3.1.tar.gz.
File metadata
- Download URL: pyfscode-0.3.1.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
099cd1afdae2fbe616ad50c20fb726ba13632908f2e919056632ff7af66f8c65
|
|
| MD5 |
96be81fb89edff342c2f411be9744392
|
|
| BLAKE2b-256 |
98010ae3dae8266dee9ba26306f22119d763e56cc4c11a6688c9554c7160967e
|
File details
Details for the file pyfscode-0.3.1-py3-none-any.whl.
File metadata
- Download URL: pyfscode-0.3.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
381cea9a934164894236df898bf2de28376d9cf8d5dd3dcde76f60562fa0cac4
|
|
| MD5 |
2654f6f39da82c38bc60230917c8a047
|
|
| BLAKE2b-256 |
37cf5d393f5132181fad0d8ed4c627b52da69e8c2c0a3429cf828162ffa96320
|