- 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.
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 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 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
- 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
- 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
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
-
(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
- Innaky ([email protected])
Copyright (c) 2020 Innaky ([email protected])
Licensed under the GPLv3 License.