Skip to content

Deleting spaces, adding prefix or suffix and adding prefix or suffix using a filter. Applying this functionalities massively for filenames of a directory.

License

Notifications You must be signed in to change notification settings

innaky/out-spaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Out-Spaces

  • Rename the filenames of a directory, deleting spaces and joining the name.
  • Adding prefix or sufix for the filenames of a directory.
  • Adding prefix or sufix using a filter for file type of a directory.
  • Replace any letter of the filename.
  • Delete any letter of the filename.

Usage

Delete any letter

For delete any letter, util for delete unicode characters

CL-USER> (out-spaces:generic-trim #\á "/home/innaky") 
  • Before
ls ~
my_file_áexample.lisp
  • After
ls ~
my_file_example.lisp

Replace any letter

Replace Any letter of the filenames, util for "change" unicode characters to ascii characters.

CL-USER> (out-spaces:replace-letter #\e #\é "/home/innaky"
  • Before
ls ~
my_filé.lisp
  • After
ls ~
my_file.lisp

Delete spaces

Delete the spaces of the filenames

CL-USER> (out-spaces:space-trim "/home/innaky/")
  • Before (list the files)
$ > ls ~
'my file.png' 'another filename example.lisp'
  • After
$ > ls ~
myfile.png anotherfilenameexample.lisp

Prefix - Sufix filename

  • List files
$ > ls /home/innaky/test
foo.lisp bar.png
  • Apply Prefix action
CL-USER> (ql:quickload :out-spaces)
CL-USER> (out-spaces:psfix "pf" "prefix-test-" "/home/innaky/test")
  • Check change
$ > ls /home/innaky/test
prefix-test-foo.lisp prefix-test-bar.png
  • Apply Sufix action
CL-USER> (out-spaces:psfix "sf" "--sufix" "/home/innaky/test")
  • Check changes
$ > ls /home/innaky/test
foo--sufix.lisp bar--sufix.png

Filter Prefix or Sufix

  • First (list the files)
$ > ls /home/innaky/test
a.lisp a.jpg file.lisp hello world.lisp pic.png doc.pdf
  • Apply Filtered prefix
CL-USER> (out-spaces:psfix-filter "pf" "test-" "/home/innaky/test" "lisp")
  • Check changes
$ > ls /home/innaky/test
test-a.lisp a.jpg test-file.lisp test-hello world.lisp pic.png doc.pdf

Installation

You need install quicklisp, next:

Using quicklisp copy in your local-projects

  • steps
$ > cd ~/quicklisp/local-projects
git clone https://github.com/innaky/out-spaces.git

Reference

  • (space-trim directory-path) This function take a directory path. Return a joining filenames (without spaces).

  • (add-psfix ["pf"|"sf"] str-fix directory-path) This function take the string pf for prefix or sf for sufix, an string for add in the filename and a directory-path Return the string-fix added in all filenames of a directory.

  • (psfix-filter ["pf"|"sf"] str-fix directory-path file-extension) This function take an file-extension and apply the prefix or sufix change in this files. This function run only with explicit filename extension, is a soft filter

  • (generic-trim character directory-path) Delete the match character in filenames of directory-path

  • (replace-letter new-letter to-replace directoy-path) Replace to-replace by new-letter in filename of directory-path

Author

Copyright

Copyright (c) 2020 Innaky (innaky@protonmail.com)

License

Licensed under the GPLv3 License.

About

Deleting spaces, adding prefix or suffix and adding prefix or suffix using a filter. Applying this functionalities massively for filenames of a directory.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published